summaryrefslogtreecommitdiff
path: root/pango
Commit message (Collapse)AuthorAgeFilesLines
* Save coverage to a filewip-bitmatrixMatthias Clasen2021-02-223-4/+220
| | | | | | | | | | | Save coverage order in $XDG_CONFIG_HOME/pango/coverage.order. We compare the hashes of all fonts to identify when the coverage order needs to be recomputed. Rough numbers show that loading the coverage from a file takes < 10ms, while computing it from scratch takes >400ms. So this is clearly a win.
* Get the coverage order early onMatthias Clasen2021-02-221-1/+15
| | | | | Trigger the generation of the coverage order as soon as fontconfig is initialized.
* Compute the coverage order ahead of timeMatthias Clasen2021-02-224-9/+360
| | | | | | | | | | | | | | | | | | | | | | | | Store a full matrix for the partial order of coverage subsets. To avoid this growing too large, use an indirection to store the information only once for identical charsets. On my system, with 4000 fonts, I see ~300 different charsets. Computing the full matrix takes a while - ~240ms. But we only have to do this once, we do it in a thread, and we can possibly store it and load it from disk. Unlike our other thread use, we won't block for the coverage, ever. Until it is available, things are simply slower. With the coverage order data, we can avoid most of the expensive charset subset calculations when trimming fontsets. This finally gets a font chooser up on the screen in less a second, on my system (~800ms).
* Do coverage trimming incrementallyMatthias Clasen2021-02-221-3/+42
| | | | | | | | | Some tradeoffs here. FcFontSetSort returns faster (5.4ms vs 6.75ms), but we have much bigger fontset (~ 4k fonts vs ~200), and we have to keep extra data around (the charset, and the skip table).
* 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.
* Leave pango-version-macros.h out of the girgir-fixesMatthias Clasen2021-02-151-2/+3
| | | | | PANGO_VERSION_MIN_REQUIRED is a build utility, and is not useful as a constant in the gir. Leave it out.
* Include version macros in the girMatthias Clasen2021-02-151-2/+2
| | | | | PANGO_MAJOR/MINOR/MICRO_VERSION are useful to have in the gir.
* Trick g-ir-scanner some moreMatthias Clasen2021-02-151-2/+2
| | | | | Add casts to get some defined constants to have the right type in the gir. The games we play...
* Trick g-ir-scannerMatthias Clasen2021-02-151-3/+4
| | | | | | | | | g-ir-scanner's handling of #defines is really rudimentary, so we have to trick it to pick up PANGO_ATTR_TO_TEXT_END as a constant with value 0, and then override the value with an annotation. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/369
* docs: Remove references to gdk_pango_context_get_for_screendocs-tweakMatthias Clasen2021-02-112-4/+2
| | | | Remove references to a function that no longer exists in gtk.
* 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
* Merge branch 'attr-list-overflow' into 'master'Matthias Clasen2021-01-241-1/+8
|\ | | | | | | | | | | | | Attr list overflow Closes #455 See merge request GNOME/pango!278
| * Avoid overflow when updating attr listsattr-list-overflowMatthias Clasen2021-01-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | Avoid overflow when updating the end_index of attributes in pango_attr_list_update. This is a real risk, because end_index is commonly set to G_MAXUINT to mean 'until the very end'. Test included. Fixes: #455
| * Add some preconditionsMatthias Clasen2021-01-231-0/+4
| | | | | | | | | | The arguments to pango_attr_list_update are ints, but negative numbers don't make sense here.
* | Don't promise too muchMatthias Clasen2021-01-231-3/+2
|/ | | | | | | | The docs were claiming that face names are unique, but we don't know that, and it doesn't hold in practice. Fixes: #528
* Merge branch 'vertical' into 'master'Matthias Clasen2021-01-211-3/+6
|\ | | | | | | | | | | | | Translate origin point for vertical layout Closes #454 See merge request GNOME/pango!168
| * Translate origin point for vertical layoutPeng Wu2021-01-201-3/+6
| | | | | | | | | | The origin point for vertical layout needs to be translated for cairo rendering from the horizontal origin to the vertical origin.
* | Merge branch 'fix' into 'master'Matthias Clasen2021-01-211-1/+1
|\ \ | |/ |/| | | | | | | | | Fix the length checking Closes #526 See merge request GNOME/pango!273
| * Fix the length checkingWeng Xuetian2021-01-141-1/+1
| | | | | | | | Closes #526
* | use g_critical instead of g_errorNaveen M K2021-01-191-1/+1
|/ | | | | according to docs of pango_cairo_font_map_new() it shouldn't crash the application by calling g_error. Instead, it should return NULL and it can log that using g_critical.
* meson: add harfbuzz gobject dependencyStéphane Cerveau2021-01-131-1/+6
| | | | | | | | When harfbuzz is built as a subproject, the gobject dep should be used to generate the gir. The build was failing when the harfbuzz gir was not available system wide.
* coretext: CleanupMatthias Clasen2021-01-042-12/+0
| | | | Remove the unused face setter and field.
* macos: Implement pango_font_get_faceMatthias Clasen2021-01-043-1/+55
| | | | | | | This was returning NULL for coretext fonts. Good that we have tests for this. Fixes: #524
* Docs: fix a typoMatthias Clasen2021-01-031-1/+1
|
* Amend the shaping api docsshape-docsMatthias Clasen2020-11-071-4/+19
| | | | | | | Discuss problems with extra_attr indices in the docs for pango_shape() and friends. See: #511
* Merge branch 'regular-face' into 'master'Matthias Clasen2020-11-061-8/+23
|\ | | | | | | | | fontconfig: Try harder to find a default face See merge request GNOME/pango!258
| * 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.
* | Merge branch 'regular-face' into 'master'Matthias Clasen2020-11-051-3/+7
|\ \ | |/ | | | | | | fontconfig: Try harder to return a default face See merge request GNOME/pango!256
| * 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".
* | ft2, xft: Write out the full type of the SubstituteFuncwip/issue510Simon McVittie2020-11-052-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | If the SubstituteFunc used for the now-deprecated set_default_substitute functions is an alias for PangoFcSubstituteFunc, GObject-Introspection doesn't realise it's a function pointer, and doesn't flag the user data and destroy-notify arguments as such. This results in bindings like PyGI thinking that they are entirely separate arguments, which is an introspection API break (and probably not something that can practically be called any more). Signed-off-by: Simon McVittie <smcv@debian.org> Resolves: https://gitlab.gnome.org/GNOME/pango/-/issues/510
* | Merge branch 'override-dependency' into 'master'Matthias Clasen2020-10-141-0/+5
|\ \ | |/ |/| | | | | meson: Use meson.override_dependency() See merge request GNOME/pango!250
| * meson: Use meson.override_dependency()Xavier Claessens2020-09-301-0/+5
| | | | | | | | | | This allows projects that use pango as a subproject to not hardcode dependency variable names such as 'libpangocairo_dep'.
* | meson: Change introspection option to yielding featureXavier Claessens2020-09-301-1/+2
|/ | | | | | | Yielding option means that if pango is built as a subproject, it will take the value of that option from the parent project (e.g. gst-build). For that to work it must be of the same type, which is "feature" instead of "boolean" in all GStreamer modules.
* Revert "meson: Change introspection option to yielding feature"Matthias Clasen2020-09-301-2/+1
| | | | | | | This reverts commit 82cfabbabaade239beb26136cb28c98156552ea5. This change broke GTK ci, and it takes more work to fix it than I can invest atm. We can try again when GTK is ready for it.
* Skip a pangofc accessorEmmanuele Bassi2020-09-301-1/+1
| | | | | | The handwritten fontconfig introspection data does not cover all types, and even if it did, it wouldn't know how to handle their ownership because fontconfig is not a GObject-based API.
* meson: Change introspection option to yielding featureXavier Claessens2020-09-291-1/+2
| | | | | | | Yielding option means that if pango is built as a subproject, it will take the value of that option from the parent project (e.g. gst-build). For that to work it must be of the same type, which is "feature" instead of "boolean" in all GStreamer modules.
* fc: Add a getter for PangoFcFont::patternfont-pattern-getterMatthias Clasen2020-09-212-0/+20
| | | | Properties are better with getters.
* 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.
* Adapt deprecationsMatthias Clasen2020-09-183-8/+8
| | | | | Move things around to reflect the fact that we are now in 1.47, and use our deprecation macros.
* Merge branch 'ch/83' into 'master'Matthias Clasen2020-09-188-64/+115
|\ | | | | | | | | | | | | 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-138-60/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * single function type for FC substitute callbackCaleb Hearon2020-06-133-4/+13
| |
* | pangofc: Add pango_fc_font_get_languagespreferred-languagesMatthias Clasen2020-09-184-1/+94
| | | | | | | | | | | | | | 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.
* | Add pango_language_get_preferredMatthias Clasen2020-09-182-4/+35
| | | | | | | | | | | | This returns the list of preferred languages, as determined from the PANGO_LANGUAGES or LANGUAGES environment variables.