Set Pango context language to undetermined (bc80df21) · Commits · René de Hesselle / inkscape · GitLab
Alvin Wong
·
2025-12-03
·
via inkscape:windows_ci_14x commits
Set Pango context language to undetermined
This prevents Pango from unconditionally applying a default language to
text.
The Pango language tag is used to apply the OpenType `locl` feature,
which selects language-specific glyphs variants in some fonts. In SVG
the `xml:lang` attribute can be used to specify the language of an
element and its descendants, which Inkscape passes to Pango as the
language tag.
However, when the SVG elements does not have a language specified, the
default behaviour of Pango is to use a default language which is
determined from the current locale of the process. This is undesirable
not only because the default can be different for every users, but also
it prevents the selection of language-specific glyphs by using the font
family name alone (e.g. "Source Han Sans TC" and "Source Han Sans SC").
By setting the context language to `und` (undetermined) we can suppress
this default behaviour so that the default language-specific glyphs of
the font family are used.
| Original line number |
Diff line number |
Diff line |
|
@@ -221,6 +221,7 @@ FontFactory::FontFactory() |
|
|
: fontServer(pango_ft2_font_map_new())
|
|
|
, fontContext(pango_font_map_create_context(fontServer))
|
|
|
{
|
|
|
pango_context_set_language(fontContext, pango_language_from_string("und"));
|
|
|
_font_map = Glib::wrap(fontServer);
|
|
|
pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(fontServer), 72, 72);
|
|
|
#if PANGO_VERSION_CHECK(1,48,0)
|
|
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。