summaryrefslogtreecommitdiff
path: root/pango/pangowin32.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'win32-cmap-free' into 'master'Matthias Clasen2021-07-091-0/+59
|\ | | | | | | | | pangowin32: Clear cmap on finalize See merge request GNOME/pango!318
| * pangowin32: Clear cmap on finalizeSeungha Yang2021-04-071-0/+59
| | | | | | | | | | 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-56/+59
|/ | | | | Remove leftovers like #Type, reduce indentations to avoid markdown block quotes, etc.
* pangowin32: Don't leak various member variables of PangoWin32Font objectSeungha Yang2021-04-051-4/+1
| | | | Fix for memory leaks around PangoWin32Font
* docs: Remove no-longer used sectionsMatthias Clasen2021-03-111-8/+0
| | | | | | These don't have enough meat to warrant turning them into .md files, so just drop them. They are no longer used.
* Correct a typo in pangowin32.cFelix Yan2020-08-121-1/+1
|
* win32: Use GPrivate-managed display device contextYongsu Park2020-05-191-19/+33
| | | | | | | | | | | | | | | | | | | | | 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
* win32: Add a placeholder for new underline valuesMatthias Clasen2019-11-011-0/+5
| | | | | | | | Somebody with access to a win32 machine will have to implement these, as well as overline. This placeholder should at least fix the build with draconian compiler flags (-Werror=switch).
* PangoWin32: Use hb_font_get_nominal_glyphKhaled Hosny2019-07-271-695/+17
| | | | | 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-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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-6/+0
| | | | We don't need this anymore since we need Vista or later to run.
* Merge branch 'wip/kill-shape-engine' into 'master'Matthias Clasen2019-07-181-44/+0
|\ | | | | | | | | Kill shape engines See merge request GNOME/pango!75
| * win32: Stop providing a shape engineMatthias Clasen2019-07-181-44/+0
| | | | | | | | It is no longer used.
* | Make hb fonts immutable in the frontendMatthias Clasen2019-07-181-2/+0
|/ | | | | | It makes more sense to do this in the frontend that hands the objects out, rather than in each backend implementation.
* win32: Implement create_hb_fontChun-wei Fan2019-07-181-0/+85
| | | | | | | | | This renders correctly in ci. This attempts to acquire the hb_font_t from the HFont that we acquire from the Windows HFONT that we use, so that we can pass things to HarfBuzz, which will handle the shaping for us. win32: Set scale on hb font
* Documentation tweaksMatthias Clasen2019-07-131-1/+1
|
* win32: Set line height in metricsMatthias Clasen2019-07-051-0/+1
| | | | | Following information found here: https://docs.microsoft.com/en-us/windows/win32/gdi/string-widths-and-heights
* win32: remove redundant function declarationsChristoph Reiter2018-04-051-5/+0
| | | | | | The meson build uses -Werror=redundant-decls and fails. https://bugzilla.gnome.org/show_bug.cgi?id=795012
* Win32: Remove "uncolored" from docsNicolas Hake2017-04-071-2/+2
| | | | | | | Since win32_render_layout and win32_render_layout_line now support rendering in color, that word no longer applies. https://bugzilla.gnome.org/show_bug.cgi?id=768679
* Win32: Fix background rect boundsNicolas Hake2017-04-071-2/+2
| | | | | | | | Rectangle() uses x1, y1, x2, y2 coordinates instead of x, y, w, h. Fix the coordinates passed to the function so it draws the background in the correct location. https://bugzilla.gnome.org/show_bug.cgi?id=768679
* Win32: Draw background box in correct colorNicolas Hake2017-04-071-9/+9
| | | | | | | Adding 128 to the component value would overflow in colors with full brightness and set the component to 0. https://bugzilla.gnome.org/show_bug.cgi?id=768679
* Win32: Reset BkMode so ETO doesn't draw its ownNicolas Hake2017-04-071-0/+3
| | | | | | | | | If the DC's background mode is set to OPAQUE, ExtTextOut will draw its own background boxes around glyph items. Since we don't place any requirements on the DC, set the background mode to TRANSPARENT before rendering any glyphs (and reset it to its original value afterwards). https://bugzilla.gnome.org/show_bug.cgi?id=768679
* Win32: Enable colored underline drawingNicolas Hake2017-04-071-3/+32
| | | | | | | | | Underline drawing was using the pen selected into DC before pango_win32_render_layout_line was called. Since layout allow the user to select underline colors, we have to create a temporary pen in the correct color before drawing it. https://bugzilla.gnome.org/show_bug.cgi?id=768679
* Win32: Enable rendering colored textNicolas Hake2017-04-071-10/+8
| | | | | | | | | Increasing the component values by 128 may overflow and result in that component being treated as 0. Additionally, using a brush to color text is wrong; ExtTextOut instead uses the color set by SetTextColor to draw glyphs. https://bugzilla.gnome.org/show_bug.cgi?id=768679
* Fix MT-unsafe initializationsBehdad Esfahbod2015-04-041-4/+5
|
* Deprecate module system, skip it for shaper modulesBehdad Esfahbod2015-04-041-21/+34
| | | | | | | | | | | | | | 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.
* Increase MAX_FREED_FONTS valueMax2014-12-041-1/+1
| | | | | | | | Increasing MAX_FREED_FONTS value should make fontset's cache working normally because of long alias list and available fonts under Windows 7. https://bugzilla.gnome.org/show_bug.cgi?id=738868
* Fix weak pointer leakMax2014-12-041-0/+3
| | | | | | This patch fixes a leak with lost weak references in fontset. https://bugzilla.gnome.org/show_bug.cgi?id=738868
* Add many missing nullability annotations.Evan Nemerson2014-10-161-1/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=731022
* Bug 685167 - migrate docs to no-tmpl flavourBehdad Esfahbod2013-09-271-0/+8
| | | | Patch from Rafał Mużyło.
* Port PangoWin32 to use GWeakRefBehdad Esfahbod2013-03-151-6/+6
| | | | Patch from Chun-wei Fan.
* [win32] Fix assertion and warningsBehdad Esfahbod2013-02-251-3/+9
| | | | | | 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.
* More churnBehdad Esfahbod2012-08-281-7/+6
|
* Improve performance on Windows especially for non-Latin scriptsTor Lillqvist2010-06-261-18/+11
| | | | | | | The use of Uniscribe script caches was decidedly suboptimal. Use one persistent SCRIPT_CACHE per Win32 font and script. Patch by by David E. Hollingsworth and Fredrik Corneliusson, from bug
* Bug 143542 – PangoFT2Fontmap leakBehdad Esfahbod2008-08-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 547432: Deprecation of pango_(backend)_font_map_create_context() notSven Herzberg2008-08-121-4/+3
| | | | | | | | | | | | | | | | | | | 2008-08-12 Sven Herzberg <sven@imendio.com> Bug 547432: Deprecation of pango_(backend)_font_map_create_context() not clean reviewed by: Behdad Esfahbod * pango/pangocairo-fontmap.c, * pango/pangofc-fontmap.c, * pango/pangoft2-fontmap.c, * pango/pangowin32.c, * pango/pangox.c, * pango/pangoxft-fontmap.c: use "Deprecated:" for deprecation messages; fix the deprecation version number svn path=/trunk/; revision=2689
* Make the following API public:Behdad Esfahbod2008-08-061-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-08-05 Behdad Esfahbod <behdad@gnome.org> * pango/pango-context.c: * pango/pango-context.h: Make the following API public: pango_context_new() pango_context_set_font_map() * pango/pango-fontmap.c (pango_font_map_create_context): * pango/pango-fontmap.h: New public API: pango_font_map_create_context() * pango/pangocairo-context.c (pango_cairo_create_context): * pango/pangocairo-font.c (_pango_cairo_font_get_metrics), (_pango_cairo_font_private_get_hex_box_info): * pango/pangocairo-fontmap.c (pango_cairo_font_map_create_context): * pango/pangocairo.h: Deprecate pango_cairo_font_map_create_context(). * pango/pangofc-font.c (pango_fc_font_get_metrics): * pango/pangofc-fontmap.c (pango_fc_font_map_create_context): * pango/pangofc-fontmap.h: Deprecate pango_fc_font_map_create_context(). * pango/pangoft2-fontmap.c (pango_ft2_font_map_create_context), (pango_ft2_get_context): * pango/pangoft2.h: Deprecate pango_ft2_font_map_create_context(). * pango/pangowin32.c (pango_win32_get_context), (pango_win32_font_get_metrics): * pango/pangowin32.h: Deprecate pango_win32_get_context(). * pango/pangoxft-font.c (_pango_xft_font_get_mini_font): * pango/pangoxft-fontmap.c (pango_xft_get_context): * pango/pangoxft.h: Deprecate pango_xft_get_context(). * pango/pangox-fontmap.c (pango_x_font_map_for_display): * pango/pangox.c (get_context_info), (pango_x_get_context), (pango_x_context_set_funcs), (pango_x_render_layout_line): Deprecate pango_x_get_context(), again. * docs/pango-sections.txt: * docs/tmpl/fonts.sgml: * pango-view/viewer-pangocairo.c (pangocairo_view_get_context): * pango-view/viewer-pangoft2.c (pangoft2_view_get_context): * pango-view/viewer-pangox.c (pangox_view_get_context): * pango-view/viewer-pangoxft.c (pangoxft_view_get_context): * pango/check.defs: * pango/pango.def: Update. svn path=/trunk/; revision=2675
* 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
* pango/pangowin32.c Some whitespace cleanup.Tor Lillqvist2008-05-261-5/+5
| | | | | | | | | | 2008-05-26 Tor Lillqvist <tml@novell.com> * pango/pangowin32.c * pango/pangowin32-fontmap.c: Some whitespace cleanup. svn path=/trunk/; revision=2636
* Bug 531242 – Leak when calculating win32 font coverage Patch from DanielBehdad Esfahbod2008-05-031-2/+7
| | | | | | | | | | | | 2008-05-03 Behdad Esfahbod <behdad@gnome.org> Bug 531242 – Leak when calculating win32 font coverage Patch from Daniel Atallah * pango/pangowin32.c (pango_win32_font_calc_coverage): Plug leak. svn path=/trunk/; revision=2623
* Bug 515484: Pango on Windows is missing Type 1 font support Patch fromTor Lillqvist2008-02-241-12/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-02-24 Tor Lillqvist <tml@novell.com> Bug 515484: Pango on Windows is missing Type 1 font support Patch from Adrian Johnson. * pango/pangowin32-private.h (PangoWin32Face): Add has_cmap field that tells whether the font has a cmap or not. A Type 1 font doesn't. * pango/pangowin32.c (pango_win32_font_get_type1_glyph_index): New static function. Uses GetGlyphIndicesW() to get the glyph indices for Type 1 fonts. Possibly also TrueType fonts that for some reason lack the cmap formats we understand. (pango_win32_font_calc_type1_coverage): New static function. Uses GetFontUnicodeRanges() to get the coverage for Type 1 fonts, and possibly TrueType fonts that lack the cmap formats we understand. (pango_win32_font_get_glyph_index): Set has_cmap to false if the font doesn't have a cmap. Call pango_win32_font_get_type1_glyph_index() in that case. (pango_win32_font_calc_coverage): Set has_cmap to false if the font doesn't have a cmap. Call pango_win32_font_calc_type1_coverage() in that case. * pango/pangowin32-fontmap.c (pango_win32_enum_proc): Accept also Type 1 fonts. (pango_win32_insert_font): Initialise has_cmap tentativaly to True. svn path=/trunk/; revision=2573
* Bug 469313 – Add pango_layout_set_height() Bug 508179 – PangoGlyphUnitBehdad Esfahbod2008-01-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-01-14 Behdad Esfahbod <behdad@gnome.org> Bug 469313 – Add pango_layout_set_height() Bug 508179 – PangoGlyphUnit confusion * pango/pango-layout.h: * pango/pango-layout-private.h: * pango/pango-layout.c: * pango/ellipsize.c (_pango_layout_line_ellipsize): New public API: pango_layout_set_height() See docs for semantics. Currently only negative height values (number of lines) is implemented. * pango-view/viewer-render.c (make_layout), (output_body), (parse_options): Implement --height. * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/layout.sgml: Update. 2008-01-14 Behdad Esfahbod <behdad@gnome.org> Bug 508179 – PangoGlyphUnit confusion * pango/pangowin32.c: * pango/glyphstring.c: * pango/pango-layout.c (process_item): Remove all traces of #PangoGlyphUnit svn path=/trunk/; revision=2542
* Add new symbols to docs.Behdad Esfahbod2007-03-121-1/+1
| | | | | | | | | | | | 2007-03-12 Behdad Esfahbod <behdad@gnome.org> * docs/pango-sections.txt: * pango/pangowin32-fontmap.c: * pango/pangowin32.c: Add new symbols to docs. svn path=/trunk/; revision=2216
* pango/pangowin32-private.h pango/pangowin32.c pango/pangowin32-fontcache.cTor Lillqvist2007-03-101-67/+111
| | | | | | | | | | | | | | | | | | 2007-03-10 Tor Lillqvist <tml@novell.com> * pango/pangowin32-private.h * pango/pangowin32.c * pango/pangowin32-fontcache.c * pango/pangowin32-fontmap.c * pango/pangocairo-win32font.c * pango/pangowin32.def: Move functions defined in one file and used in another to the file where used, make them static, and drop from pangowin32-private.h. Prefix all private non-static functions with underscore. Also functions used only by the pangocairo DLL are considered private. (#120195) svn path=/trunk/; revision=2213
* This change was supposed to go in the trunk before 1.16.0, but it didn'tTor Lillqvist2007-02-271-14/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-02-26 Tor Lillqvist <tml@novell.com> This change was supposed to go in the trunk before 1.16.0, but it didn't quite get there in time. So, to have a clear cut for this somewhat fundamental change in underlying workings (although there should be no user-visible changes), I will build and distribute Win32 binaries only starting from 1.16.1. Use wide character API for fonts on Windows. Rename functions and variables that deal with LOGFONTW structs to emphasize this. (#407315) * pango/pangowin32.c * pango/pangowin32-fontcache.c * pango/pangowin32-fontmap.c: Use LOGFONTW all over the place instead of LOGFONT, and adapt code accordingly. Use wide character Win32 API. * pango/pangowin32.c (pango_win32_font_neww): Renamed from pango_win32_font_new(), as it now takes a LOGFONTW pointer. This is a private function and can be renamed though it is exported as it is used from the pangocairo DLL. (pango_win32_font_logfont): Mention explicitly in doc comment that it returns a LOGFONTA, and recommend to use pango_win32_font_logfontw() instead. (pango_win32_font_logfontw): New function. * pango/pangowin32-fontcache.c (pango_win32_font_cache_load): Must keep this function that takes a LOGFONTA pointer as it is declared in the public header. (pango_win32_font_cache_loadw): New public function that takes a LOGFONTW pointer. * pango/pangowin32-fontmap.c (pango_win32_font_description_from_logfont): Mention explicitly in the doc comment that it takes a LOGFONTA pointer. (pango_win32_font_description_from_logfontw): New public function that takes a LOGFONTW pointer. (pango_win32_make_matching_logfontw): Rename from pango_win32_make_matching_logfont() to emphasize it takes a LOGFONTW pointer. * pango/pangowin32.h: Declare new public functions. * pango/pangowin32-private.h: Declare new private functions, drop removed ones. * pango/pangocairo-win32font.c (_pango_cairo_win32_font_new): Simplify now that we call pango_win32_make_matching_logfontw(). * pango/pangowin32.def: Add new functions, rename internal functions that now use LOGFONTW. 2007-02-26 Tor Lillqvist <tml@novell.com> Fix brokenness in the code that tries to ensure that all fonts also have italic variants. Now the code hopefully actually does what it was supposed to. (Which is not necessarily the right thing to do, though. It can be argued that we should not list synthesized italic font styles, we should just silently generate them if asked for. We don't want synthesized italic (or synthesized bold) styles showing up in the font selector. They don't show up when using a fontconfig-based Pango backend either.) (#110521) * pango/pangowin32-fontmap.c (logfont_nosize_hash, logfont_nosize_equal): Don't use the lfItalic field as such, just its nonzeroness. When being enumerated, italic fonts show up with lfItalic=255, but our code looks up italic versions of fonts by passing a key LOGFONT with lfItalic=1. (first_match): Not needed any more, see below. (ensure_italic): This is now called on the entries in the size_infos hash table, not families. The code used to randomly look for the first matching font in size_infoswith the family name being handled. (pango_win32_font_map_init): Iterate through the size_infos hash table with ensure_italic, not through the families table. * pango/pangowin32-fontcache.c (logfontw_hash, logfontw_equal): Look at just nonzeroness of lfItalic here, too. svn path=/trunk/; revision=2204
* *.c, *.h: Replace preceding sequences of 8 spaces with tabs.Behdad Esfahbod2007-01-161-27/+27
| | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> *.c, *.h: Replace preceding sequences of 8 spaces with tabs. svn path=/trunk/; revision=2165
* *.c, *.h: Drop trailing whitespace.Behdad Esfahbod2007-01-161-91/+91
| | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> *.c, *.h: Drop trailing whitespace. svn path=/trunk/; revision=2163
* Use pango_layout(_iter)?_get_line_readonly() instead ofBehdad Esfahbod2007-01-161-2/+2
| | | | | | | | | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> * examples/cairotwisted.c (draw_text): * pango/pangocairo-win32font.c (max_glyph_width): * pango/pangofc-font.c (max_glyph_width): * pango/pangowin32.c (max_glyph_width), (pango_win32_render_layout): * pango/pangox.c (pango_x_render_layout): Use pango_layout(_iter)?_get_line_readonly() instead of pango_layout(_iter)?_get_line(). svn path=/trunk/; revision=2146
* Spell-check the docs.Behdad Esfahbod2007-01-071-4/+4
| | | | svn path=/trunk/; revision=2130
* Bug 355435 – Invalid calls to pango_map_get_engine() Patch fromBehdad Esfahbod2006-09-111-1/+3
| | | | | | | | | | | | | | 2006-09-11 Behdad Esfahbod <behdad@gnome.org> Bug 355435 – Invalid calls to pango_map_get_engine() Patch from Theppitak Karoonboonyanan * pango/break.c (pango_get_log_attrs): * pango/pango-renderer.c (add_underline): * pango/pangofc-font.c (pango_fc_font_find_shaper): * pango/pangowin32.c (pango_win32_font_find_shaper): * pango/pangox.c (pango_x_font_find_shaper): Pass a PangoScript to pango_map_get_engine, not a gunichar!