summaryrefslogtreecommitdiff
path: root/pango/pangowin32-fontmap.c
Commit message (Collapse)AuthorAgeFilesLines
* pangowin32-fontmap.c: Look harder for the matching fontChun-wei Fan2021-08-091-3/+19
| | | | | | | | | | | | When we look up our font from the list of fonts that we enumerated from the system, follow what the CoreText backend does, so that if the font gravity in the font description is getting in our way to find the font, look for it again without the gravity. This will enable us to find the font that really exists but was not found due to FontDescription attributes. Partially fixes #583.
* Fix a compiler warningMatthias Clasen2021-07-091-1/+0
|
* Merge branch 'win32-cmap-free' into 'master'Matthias Clasen2021-07-091-2/+2
|\ | | | | | | | | pangowin32: Clear cmap on finalize See merge request GNOME/pango!318
| * pangowin32: Clear cmap on finalizeSeungha Yang2021-04-071-2/+2
| | | | | | | | | | Implement copy method for format_4_cmap and format_12_cmap, and free don't leak the struct.
* | docs: Convert gtk-doc syntax leftoversdocs-cleanupMatthias Clasen2021-05-191-15/+17
| | | | | | | | | | Remove leftovers like #Type, reduce indentations to avoid markdown block quotes, etc.
* | 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 a typo in pango/pangowin32-fontmap.c which causedNaveen M K2021-03-151-1/+1
| | | | | | | the `Cursive` default fallback to not load/work on Windows It should be `comic` and not `commic`. Signed-off-by: Naveen M K <naveen@syrusdark.website>
* docs: Replace lots of vestigial xml markupMatthias Clasen2021-03-111-2/+2
| | | | | We want to use pure markdown, since docbook is going away as the intermediate format.
* pangowin32-fontmap.c: Fix build on older compilersChun-wei Fan2020-08-261-1/+3
| | | | Declare variables at the top of the block...
* Fixes pango_win32_font_map_load_font when font contains fallback familiesEvgenii Gurianov2020-08-041-23/+28
|
* pangowin32-fontmap: delete no longer needed font map aliasesAaron Boxer2020-06-081-6/+2
|
* pangowin32-fontmap: load windows fallbacks and aliases in class initAaron Boxer2020-06-081-17/+10
| | | | | | | Currently, because of the g_once_init*, only the very first font map that is created will get the correct list of aliases. With these changes the fontmap class loads the aliases once, and this hash table is used by all fontmap objects.
* win32: Use GPrivate-managed display device contextYongsu Park2020-06-081-20/+39
| | | | | | | | | | | | | | | | | | | | | The document of [CreateDCA][1] says: > If lpszDriver or lpszDevice is DISPLAY, the thread that calls > CreateDC owns the HDC that is created. When this thread is > destroyed, the HDC is no longer valid. Thus, if you create the HDC > and pass it to another thread, then exit the first thread, > the second thread will not be able to use the HDC. So this change introduces GPrivate to fix potential problem. This also fixes the problem caused by accessing the global variable DC directly, which makes some early call to Pango functions fail. (e.g., failure of calling pango_win32_font_description_from_logfontw from _get_system_font_name in GTK.) [1]: https://docs.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdca
* Add pango_font_get_faceMatthias Clasen2019-10-311-1/+10
| | | | | 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-2/+13
|
* PangoWin32: Use hb_font_get_nominal_glyphKhaled Hosny2019-07-271-15/+39
| | | | | Use hb_font_get_nominal_glyph in pango_win32_font_get_glyph_index (deprecated), to better match what Pango is actually using internally.
* PangoWin32: Make font discovery thread-safeChun-wei Fan2019-07-251-28/+28
| | | | | | | | | | | | | | | | | | | | | | Make font discovery using GDI/Unicscribe on Windows thread-safe, by: -Making the alias HashTable a part of the _PangoWin32FontMap struct, so that we only need to initialize this once when we initialize the PangoFontMap on Win32. Make sure that we fill in that hash table with the fonts items we ask from the system once and only once as we initialize the PangoWin32FontMap. -Make the warned_fonts HashTable a part of the _PangoWin32FontMap struct as well, and create the HashTable when we init the PangoWin32FontMap. -Make the access to the common HDC in pangowin32.c where Alex mentioned that could be thread-unsafe done through pango_win32_get_dc(). At this point the test-pangocairo-threads will pass in Meson, tested for 20 successive rounds using 'meson test test-pangocairo-threads'. Note that we still get the "Pango-WARNING **:hh:mm:ss.sss: All font fallbacks failed!!!", but at least we are doing much better on PangoWin32 in terms of thread-safety.
* PangoWin32: Drop _pango_win32_os_version_infoChun-wei Fan2019-07-251-3/+1
| | | | We don't need this anymore since we need Vista or later to run.
* pango/pangowin32-fontmap.c: Fix code formattingChun-wei Fan2019-07-251-216/+221
| | | | Get rid of the tabs...
* Add system-ui generic family supportAkira TAGOH2019-07-241-1/+7
|
* pangowin32: add back the old font fallback list for each registered fontChristoph Reiter2019-07-211-0/+11
| | | | | | | | | | | In f523c25c12c I changed the font fallback list from hardcoded to reading it from the registry to cover all potentially default Windows UI fonts. Turns out that this doesn't cover all of Unicode and breaks things like Marathi. This adds back the language specific font fallbacks to each font read from the registry to restore the old Unicode coverage. Fixes #375
* Drop g_type_init callsMatthias Clasen2019-07-041-5/+0
| | | | | These were ifdefed to an older version of GLib than we require now, so are just dead code.
* pangowin32: Read the font fallback list from the registry instead of ↵Christoph Reiter2018-12-041-2/+103
| | | | | | | | | | | | | | | hardcoding it for some fonts. We only had a fallback list for "Segoe UI" which is the default Windows font, but not on Chinese or Korean Windows version which use "JhengHei UI" etc. and fall back to "Segoe UI". Instead of hardcoding the fallbacks in the alias list read them from the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink) This should allow us to use the default Windows font by default in gtk+ on Win8+, see https://gitlab.gnome.org/GNOME/gtk/merge_requests/436 for details. This also bumps the required Windows version to Vista for RegGetValueW().
* pangowin32-fontmap.c: Add an Emoji font familyChun-wei Fan2018-03-311-1/+2
| | | | | | | | | | | | | | | | | | | Add an Emoji font family that maps to the following fonts in this order (by fallback): Segoe UI Emoji Segoe UI Symbol Segoe UI This will enable Emoji to be displayed correctly in GTK+ apps (without the use of FontConfig) on Windows Vista and later, providing that one of the aforementioned fonts are installed. Note that this only enables Emoji display (*not* colored ones) as achieving colored Emoji requires PangoWin32 and Cairo to be ported to Direct2D and DirectWrite from Uniscribe and GDI, as Uniscribe and GDI does not support colored Emoji. https://bugzilla.gnome.org/show_bug.cgi?id=794705
* Bug 764089 - PangoWin32FontMap Memory LeakBehdad Esfahbod2016-03-261-3/+53
| | | | | | | | Add finalizers to PangoWin32FontMap Patch from Geoffrey Yerem. Part of https://bugzilla.gnome.org/show_bug.cgi?id=764089
* Remove gmodule dependency and deprecate some more symbolsBehdad Esfahbod2015-04-051-1/+0
|
* [win32] Don't read pango.aliasesBehdad Esfahbod2015-04-041-54/+0
| | | | Part of Bug 733882 - Kill Pango modules, engines, and config files
* Deprecate module system, skip it for shaper modulesBehdad Esfahbod2015-04-041-4/+0
| | | | | | | | | | | | | | Now shaper is discovered via (previously unused!) font->find_shaper(). I'm keeping that just to allow clients override shaping. Though, even that I'm not sure we want to keep. Wraps shaper in PangoEngineShape structs to keep PangoAnalysis API intact. Deprecated pango-modules.h and some pango-engine.h. Language modules are not moved yet. Wired up PangoFc, PangoWin32, and PangoCoretext shapers.
* [win32] Bug 733764 - Support more / free font weightsBehdad Esfahbod2014-07-251-34/+4
|
* [win32] Fixup previous commitBehdad Esfahbod2014-04-091-1/+1
|
* [win32] Improve threadsafetyBehdad Esfahbod2014-04-091-21/+25
| | | | | | | | | | | | | | | | Based on patch from Chun-wei Fan. Original patch comments: Improve the thread-safety situation on Windows by only allowing the pango_aliases_ht GHashTable be populated once. Pango on Windows is not yet thread-safe, but with the thread safety patch on Cairo-Win32-Font[1], it does seem that the test program test-pangocairo-threads does not crash randomly anymore, which seems to be an improvement. [1]: https://bugs.freedesktop.org/show_bug.cgi?id=73012 Fixes https://bugzilla.gnome.org/show_bug.cgi?id=695913
* Bug 685167 - migrate docs to no-tmpl flavourBehdad Esfahbod2013-09-271-2/+2
| | | | Patch from Rafał Mużyło.
* Bug 682846 - Use G_DEFINE_TYPE in pangowin32-fontmapBehdad Esfahbod2013-03-151-55/+21
| | | | Based on patch from Chun-wei Fan.
* Port PangoWin32 to use GWeakRefBehdad Esfahbod2013-03-151-4/+4
| | | | Patch from Chun-wei Fan.
* [win32] Fix assertion and warningsBehdad Esfahbod2013-02-251-1/+3
| | | | | | When win32 fontmap goes away, font->fontmap becomes NULL. Deal with that. Technically speaking, we need to port this to GWeakRef like the other fontmaps do. But this would do for now.
* Don't call g_type_init if GLib is new enoughMatthias Clasen2013-01-071-0/+2
| | | | | g_type_init has been deprecated in GLib 2.35.x. Use a version check here to avoid depending on unstable GLib.
* Bug 685021: "Add" load_fontset() for Win32 backendChun-wei Fan2012-10-301-0/+157
| | | | | | | | | | | | We now need a load_fontset() implementation for the Windows backend as the pango.aliases handling is moved to pangowin32-fontmap.c since commit 831611158, so that it will go through the pango.aliases file and load the appropriate fontset needed to display various texts. This basically copies pango_font_map_load_fontset() from pango-fontmap.c and adds the old (pre-commit 831611158) pango_font_map_fontset_add_fonts(), but using pango_win32_font_map_load_font() in place of pango_font_map_load_font().
* pango/pangowin32-fontmap.c: Fix buildChun-wei Fan2012-09-141-1/+3
| | | | | | -Include glib/gstdio.h for g_fopen -Make up for a missed #endif -correct an internal function name, pango_load_aliases to load_aliases
* More churnBehdad Esfahbod2012-08-281-2/+2
|
* Make static data thread safe in pangowin32-fontmap.cAlessandro Pignotti2012-08-271-4/+2
|
* Make a couple of functions reentrantAlessandro Pignotti2012-08-271-8/+7
|
* Deprecate pango_lookup_aliases()Matthias Clasen2012-08-271-1/+277
| | | | Part of Bug 377539 - (pango-threadsafe) Make Pango thread-safe
* Bug 578935 – Syntax error (missing semicolon) in pango/pangowin32-fontmap.cBehdad Esfahbod2009-04-141-1/+1
| | | | Add missing semicolon.
* Allow font_family=NULL in load_font() and load_fontset() methodsBehdad Esfahbod2009-04-061-3/+5
|
* Revert change from 2008-05-28 that mapped words and word pairs thatTor Lillqvist2009-03-091-98/+2
| | | | | | | | | | indicate weight or stretch into the corrersponding Pango font description setting and stripped those word(s) from the family name. Personally I liked the effect this had on the GTK+ font picker, combining all weight and stretch variants of what de facto is one typeface family (for instance DejaVu) under one family name. But Bulia Byak reported that this caused regressions in Inkscape. So OK then.
* Bug 143542 – PangoFT2Fontmap leakBehdad Esfahbod2008-08-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-08-22 Behdad Esfahbod <behdad@gnome.org> Bug 143542 – PangoFT2Fontmap leak * pango/fonts.c: * pango/pangoatsui.c (pango_atsui_font_finalize), (_pango_atsui_font_set_font_map): * pango/pangocairo-font.c (_pango_cairo_font_get_metrics), (_pango_cairo_font_private_get_hex_box_info): * pango/pangocairo-win32font.c (_pango_cairo_win32_font_new): * pango/pangofc-font.c (pango_fc_font_get_metrics): * pango/pangofc-fontmap.c (pango_fc_font_map_add), (_pango_fc_font_map_remove), (cleanup_font): * pango/pangowin32-fontmap.c (pango_win32_font_neww), (pango_win32_font_map_real_find_font): * pango/pangowin32.c (pango_win32_font_finalize): * pango/pangox-fontmap.c (pango_x_font_map_load_font): * pango/pangox.c (pango_x_font_new), (pango_x_font_finalize): Make the reference the font->fontmap reference weak. The code for setting the reference must look like this: g_assert (font->fontmap == NULL); font->fontmap = (PangoFontMap *) fontmap; g_object_add_weak_pointer (G_OBJECT (font->fontmap), (gpointer *) (gpointer) &font->fontmap); And releasing it like: g_assert (font->fontmap != NULL); g_object_remove_weak_pointer (G_OBJECT (font->fontmap), (gpointer *) (gpointer) &font->fontmap); font->fontmap = NULL; I have converted all fontmaps. The win32 and atsui ones can use some simple testing. The PangoFc fonts actually don't need the weakref as the fontmap already provides a similar link by itself. svn path=/trunk/; revision=2704
* Include "config.h" instead of <config.h> Command used: find -nameJohan Dahlin2008-06-221-1/+1
| | | | | | | | | | | | 2008-06-21 Johan Dahlin <jdahlin@async.com.br> * *.[ch]: Include "config.h" instead of <config.h> Command used: find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g' Rubberstamped by Behdad svn path=/trunk/; revision=2657
* Map words that indicate weight and slant in the font name into theTor Lillqvist2008-05-271-9/+108
| | | | | | | | | | | | | | | | | | 2008-05-28 Tor Lillqvist <tml@novell.com> * pango/pangowin32-fontmap.c (pango_win32_font_description_from_logfont) (pango_win32_font_description_from_logfontw): Map words that indicate weight and slant in the font name into the corresponding Pango font description settings, and strip those words from the family name. This maps for instance the DejaVu Sans, DejaVu Sans Condensed and DejaVu Sans Light fonts into a single DejaVu Sans family with styles Ultra-Light, Condensed, Oblique Condensed, Oblique, Bold Condensed, Bold, Bold Oblique Condensed, and Bold Oblique, which is nice. svn path=/trunk/; revision=2644
* Rework face synthesis once again. Code is simpler now, and we don'tTor Lillqvist2008-05-271-83/+81
| | | | | | | | | | | | | | | | 2008-05-28 Tor Lillqvist <tml@novell.com> * pango/pangowin32-fontmap.c (synthesize_foreach) (_pango_win32_font_map_init): Rework face synthesis once again. Code is simpler now, and we don't needlessly synthesize bold weights for fonts that have a real semi-bold weight, like Lucida Sans. (The bold weight ended up looking like the semi-bold anyway.) (pango_win32_font_description_from_logfont): Recognize the semi-bold weight interval. svn path=/trunk/; revision=2642
* After the change to how the standard pseudo font families are set upTor Lillqvist2008-05-271-20/+2
| | | | | | | | | | | | 2008-05-27 Tor Lillqvist <tml@novell.com> * pango/pangowin32-fontmap.c (pango_win32_family_list_faces): After the change to how the standard pseudo font families are set up below, we don't need to prune out duplicate face names any longer. svn path=/trunk/; revision=2641