summaryrefslogtreecommitdiff
path: root/pango/pangofc-fontmap.c
Commit message (Collapse)AuthorAgeFilesLines
* Quiet a compiler warningMatthias Clasen2021-07-101-4/+6
| | | | | Another case where using a GPtrArray instead of a GArray of pointers is nicer.
* Remove an obsolete version checkMatthias Clasen2021-07-101-3/+0
| | | | | We require harbuzz to be at least 2.0.0 for a while now. No need to check that version at runtime.
* fontconfig: Ignore woff fontswoff-offMatthias Clasen2021-07-091-1/+9
| | | | | | | | harfbuzz creates a face, but doesn't seem to find any glyphs in woff fonts, so filter them out. Sadly, fontfonfig does not have useful format information about this, so we need to crudely filter by filename.
* Use an enum instead of numeric values for fc_initializedFederico Mena Quintero2021-07-011-5/+16
|
* Use atomic reference counting for PangoFcPatternsFederico Mena Quintero2021-07-011-18/+3
| | | | | | | There was a data race in accessing the ref_count of this struct; now with g_atomic_rc_box it's done properly across threads. Fixes https://gitlab.gnome.org/GNOME/pango/-/issues/571
* Extract function to free the contents of a PangoFcPatternsFederico Mena Quintero2021-07-011-7/+14
|
* fc: Drop a broken optimizationdrop-broken-optimizationMatthias Clasen2021-07-011-3/+0
| | | | | | | | | We were trying to cut short the wait for FcInit in pango_fc_font_map_set_config. But there was a thinko: while it is true that the fontmap which had set_config called on it does not need to wait for FcInit anymore, other threads fontmaps still do. Instead of making this more complicated, just drop the optimization.
* Clarify docs of pango_fc_fontmap_get_configget-config-docsMatthias Clasen2021-07-011-1/+2
| | | | | | | The return value is owned by Pango. transfer=none doesn't really work for non-GObject types, so just spell it out. Fixes: #572
* docs: Reduce redundancydocs-cleanupsMatthias Clasen2021-05-201-1/+1
| | | | | | Remove a boatload of "or %NULL" from nullable parameters and return values. gi-docgen generates suitable text from the annotation that we don't need to duplicate.
* fc: Don't use GTask for threadingfix-lilypond-leakMatthias Clasen2021-05-101-31/+24
| | | | | | | | | | GTask requires a running mainloop, otherwise we end up leaking task objects and their associated data. This is not a problem in GTK applications, but it does show up in batch operation, such as with lilypond. To avoid this problem, use plain threads.
* Add some NULL checksadd-null-checkdsMatthias Clasen2021-05-091-1/+2
| | | | | | | Originally suggested by Philipp Withnall in https://bugzilla.gnome.org/show_bug.cgi?id=778655 Fixes: #268
* Fix hangs that people have observedfix-deadlocks2Matthias Clasen2021-03-311-2/+1
| | | | | | | We were erroneously setting fc_initialized back to 1 in one place. But now 1 means 'wait for the FcInit thread that is already underway. Setting it to 2 restores the intention.
* Revert "Merge branch 'fix-deadlocks' into 'master'"revert-1fedc11aMatthias Clasen2021-03-311-1/+2
| | | This reverts merge request !309
* Fix hangs that people have observedfix-deadlocksMatthias Clasen2021-03-311-2/+1
| | | | | | | We were erroneously setting fc_initialized back to 1 in one place. But now 1 means 'wait for the FcInit thread that is already underway. Setting it to 2 restores the intention.
* Only initialize fontconfig oncefcinit-onceMatthias Clasen2021-03-271-13/+25
| | | | | | | When multiple fontmaps are created in quick succession, we would send off a thread to call FcInit for each one of them, which is not really necessary. Just do it once.
* Use g_memdup2()memdup2Matthias Clasen2021-03-181-2/+2
| | | | | The g_memdup() function is replaced by a safer version in newer versions of GLib.
* Fix placement of marks in upright vertical text.Tavmjong Bah2021-03-171-3/+2
|
* pangofc: Tweak docsMatthias Clasen2021-03-111-34/+47
| | | | Convert link syntax and add summaries.
* docs: Port PangoFc apis to the new doc formatMatthias Clasen2021-03-111-78/+81
| | | | | | Replace gtk-doc'isms and use gi-docgen links instead. Cross-gir links are still an open issue.
* docs: Replace lots of vestigial xml markupMatthias Clasen2021-03-111-10/+2
| | | | | We want to use pure markdown, since docbook is going away as the intermediate format.
* fc: Fix an ordering issuefontmap-thread-fixMatthias Clasen2021-02-241-0/+7
| | | | | | | | | | | | | With the recently introduced threading for fontconfig calls, we introduced an ordering issue where the fontmap may die before an outstanding thread returns, and then the code that unrefs the pattern object tries to remove it from the fontmap cache. Prevent that by giving each thread a strong ref on the fontmap while it runs. Fixes: #537
* fontconfig: Add some trace marksspeed-up-format-filteringMatthias Clasen2021-02-221-3/+41
| | | | | Add sysprof marks around the expensive fontconfig calls, and for when we are waiting on them.
* Move FcInit call to a threadMatthias Clasen2021-02-221-0/+50
| | | | | | | | | | With a big fontconfig configuration, FcInit takes some time (60-100ms on my system). Doing this work off the main thread can potentially avoid blocking other work. To take advantage of this, GTK calls pango_cairo_font_map_get_default() early to initiate the creation of a fontmap, thereby triggering the FcInit() call.
* Move FcFontMatch and FcFontSort calls to a threadMatthias Clasen2021-02-221-35/+152
| | | | | | | | | | fontconfig is thread-safe, so we can do calls that can take several milliseconds to complete in a thread. This patch does that for FcFontSetMatch and FcFontSetSort. It is a win, at least for FcFontSetSort, since it reduces the time that the main thread spends in pango_fc_patterns_get_font_pattern for i > 0 from around 10 to 6 milliseconds.
* Use FcFontSetList instead of FcFontListMatthias Clasen2021-02-221-5/+6
| | | | | | | We have filtered-by-format lists of fonts available now, so we should use them to ensure we always operate on the same set of fonts. Also, fix another case of passing NULL for the config.
* fc: Only do filtering by format onceMatthias Clasen2021-02-221-23/+58
| | | | | | The fontconfig configuration changes rarely, so we can avoid unnecessary work by only doing the filtering by supported formats once, and keeping the result.
* Use the right FcConfig for FcFontListfix-FcConfig-usesMatthias Clasen2021-02-221-1/+1
| | | | | | | | | Passing NULL for a config argument in a fontconfig api means we are using the default configuration, which may be different from the one the fontmap is supposed to be using. Fix an instance of this in pango_fc_face_list_sizes.
* Use the right FcConfig for FcRenderPrepareMatthias Clasen2021-02-221-1/+1
| | | | | | | | | Passing NULL for a config argument in a fontconfig api means we are using the default configuration, which may be different from the one the fontmap is supposed to be using. Fix an instance of this in pango_fc_fontset_load_next_font.
* Fix pango_font_describe for Emoji fontsMatthias Clasen2021-01-241-1/+18
| | | | | | | | | | | We are using the size from the FcPattern. For scalable bitmap fonts, this has been scaled to match the requested pixel size. To make a font description that can be turned back into a FcPattern and roundtrip successfully, we need to undo that scaling. Thankfully, fontconfig leaves the pixelsizefixupfactor in the pattern, so it is easy to do. Fixes: #530
* fontconfig: Try harder to find a default faceregular-faceMatthias Clasen2020-11-061-8/+23
| | | | | | | | | | | | Fonts are amazing, and not in a good way. My system has fonts with 0, 1, 2 "Regular" faces. It also has fonts where the "Regular" face is, in fact, bold. So, we need to work even harder to return a reasonable face when asked about the default. We already make a determination of faces that we consider 'regular' when we create the faces initially. Just keep that information for later reuse.
* fontconfig: Try harder to return a default faceMatthias Clasen2020-11-051-3/+7
| | | | | | | | | pango_font_family_get_face() is documented as nullable, so we are technically within our rights to return NULL, but that is unexpected when passing NULL to get the default face, and the family has faces. So, try a little harder by returning the first face if we don't find a face with the name "Regular".
* fc: Sort faces of a familysort-facesMatthias Clasen2020-09-211-0/+28
| | | | | | Make pango_font_family_list_faces() return faces sorted by slant and weight. This makes the font chooser look much less random.
* Merge branch 'ch/83' into 'master'Matthias Clasen2020-09-181-0/+25
|\ | | | | | | | | | | | | Add pango_fc_font_map_set_default_substitute Closes #83 See merge request GNOME/pango!191
| * add pango_fc_font_map_set_default_substituteCaleb Hearon2020-06-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added: pango_fc_font_map_set_default_substitute pango_fc_font_map_default_substitute_changed deprecated: pango_ft2_font_map_set_default_substitute pango_ft2_font_map_changed pango_xft_font_map_set_default_substitute pango_xft_font_map_changed Now PangoCairoFcFontMap will call what is passed to pango_fc_font_map_set_default_substitute when it is time. The deprecated functions make calls to the parent (FC) class now. The user-supplied callbacks are executed in the exact same places as before.
* | pangofc: Add pango_fc_font_get_languagespreferred-languagesMatthias Clasen2020-09-181-1/+55
| | | | | | | | | | | | | | This really belongs into PangoFont, but we're out of room in the PangoFontClass struct for vfuncs, so this will have to remain backend-specific functionality for now.
* | Remove leftover debug codeMatthias Clasen2020-08-231-2/+0
| | | | | | | | | | This #if snuck in as part of efa66e7b634050ef3. No need to keep it around.
* | Don't call FcFontSetSort twiceMatthias Clasen2020-08-151-7/+12
| | | | | | | | | | | | We can do the format filtering on the unsorted font lists. Sorting the same list twice may be fast, but there's still some setup overhead.
* | Speed up font format filteringMatthias Clasen2020-08-151-1/+4
| | | | | | | | | | We were needlessly duplicating patters when we could have just referenced them.
* | Initialise out argumentsEmmanuele Bassi2020-07-031-0/+6
| | | | | | | | | | | | | | If we bail out early, we end up with uninitialised data and no way for a caller to know that happened. Fixes: #489
* | fcfontmap: Always reject unsupported font formatsKhaled Hosny2020-06-251-26/+26
|/ | | | | Fixes https://gitlab.gnome.org/GNOME/pango/-/issues/484 and https://gitlab.gnome.org/GNOME/pango/-/issues/457
* pangofc-fontmap: Avoid a dead assignmentTimm Bäder2020-06-101-1/+1
| | | | I believe this was meant to assign to variable and not res.
* Skip introspection on low level APIEmmanuele Bassi2020-06-081-6/+19
| | | | | | We don't have introspection for fontconfig and freetype2 data types. While we do have introspection for Harfbuzz, it doesn't really work.
* family: Clarify and improve pango_font_family_get_face()Benjamin Otte2019-12-081-0/+3
| | | | | | | - Clarify that the function can return NULL - Fix annotations - Allow passing NULL as name to get a guaranteed default face. - Map the default name to "Regular" in the FC backend
* fcfontmap: Emit GListModel::changedMatthias Clasen2019-12-041-0/+19
| | | | We can implement this a bit better in the fontconfig backend.
* pangofc: Add list model implementationsMatthias Clasen2019-12-041-5/+86
| | | | | Reimplement GListModel in the fontconfig backend. This implementation avoids memory copies.
* Add pango_font_get_faceMatthias Clasen2019-10-311-0/+24
| | | | | Since we've run out of slots in PangoFontClass, this is implemented with a vfunc in PangoFontMapClass.
* Add pango_font_face_get_familyMatthias Clasen2019-10-311-0/+9
|
* Add pango_font_family_get_faceMatthias Clasen2019-10-311-12/+39
| | | | This lets us get a face by name.
* Add pango_font_map_get_familyMatthias Clasen2019-10-311-14/+48
| | | | This lets us get a PangoFontFamily by name.
* fc: remove another assertion that might triggerMatthias Clasen2019-10-251-2/+1
| | | | | Apparently, people have fonts without formats, so better don't assert, just silently skip those.