summaryrefslogtreecommitdiff
path: root/pango/pangocairo-font.c
Commit message (Collapse)AuthorAgeFilesLines
* Make missing space smallersmaller-spaceMatthias Clasen2021-12-221-1/+1
| | | | | | | The Microsoft paper I was citing actually recommends 1/4 em for ASCII space. Make it so... Update affected tests.
* Use a better size for missing spaceMatthias Clasen2021-12-211-39/+4
| | | | | | | | | | Follow the Microsoft Typography recommendations from https://docs.microsoft.com/en-us/typography/develop/character-design-standards/whitespace and use half of an em for missing space. Update affected tests. Fixes: #647
* cairo: Work harder to measure spacemore-space-tweaksMatthias Clasen2021-12-171-3/+21
| | | | | | | | | | | When coming up with a width for a missing space, we were just measuring the hex digits. But in subsetted fonts, such as the ones we use for ci, hex digits might well be missing. Take that into account and still provide some nonzero width for space. Update affected tests.
* Calculate hinted font height based on the hinted extentsSebastian Keller2021-11-221-2/+2
| | | | | | | | | | | | | The previous code was calculating the rounded up version of the difference between the unhinted ascender and uninted descender. This however would only result in the correct height if both unhinted extentss together only differ by less then an a Pango unit from their hinted counterparts. Otherwise the resulting height would be 1 unit too short. Fix this by using the difference between the hinted extents as height. Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/626
* Introduce and use FLOOR and CEIL macros in Pango unitsSebastian Keller2021-11-221-4/+4
| | | | | | | This replaces the code that was trying to implement those via the ROUND macro. This avoids a potential issue with values that already were on whole units being rounded up to the next whole unit in the code that was implementing CEIL this way.
* Make logical glyph extents betterMatthias Clasen2021-10-311-0/+2
| | | | | For east and west gravity, the logical glyph extents were still misaligned with the ink extents.
* cairo: Small fixupglyph-extents-fixesMatthias Clasen2021-10-301-1/+1
| | | | | | cf_priv->scaled_font is initialized on demand, it may be NULL. So better call the getter. This was showing up as failure in the asan test in ci.
* Use harfbuzz metrics for cairo fontsMatthias Clasen2021-10-301-14/+37
| | | | | Without this, we end up with differences in metrics of empty runs.
* cairo: Produce meaningful logical glyph extentsMatthias Clasen2021-10-301-11/+28
| | | | | Depending on gravity, our logical glyph extents were empty and mis-aligned. Fix that.
* Revert "Use harfbuzz metrics for cairo fonts"Matthias Clasen2021-10-271-22/+21
| | | | | | This broke glyph extents with gravity north or west. This reverts commit 20ec670e124e4461075a2967faa29603d25106cc.
* Use harfbuzz metrics for cairo fontsMatthias Clasen2021-10-191-21/+22
| | | | | | | Without this, we end up with differences in metrics of empty runs. Fixes: #421
* docs: Reduce redundancydocs-cleanupsMatthias Clasen2021-05-201-2/+2
| | | | | | 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.
* docs: Port PangoCairo apis to the new doc formatMatthias Clasen2021-03-111-7/+7
| | | | | | Replace gtk-doc'isms and use gi-docgen links instead. Cross-gir links are still an open issue.
* Fix some annotationsRico Tzschichholz2020-06-081-1/+1
|
* Revert "Drop cairo metrics implementation"Khaled Hosny2019-08-141-0/+194
| | | | | | This reverts commit c5d86c368128bb9a0be913829da79649fb81f486. Closes #409
* Drop cairo metrics implementationMatthias Clasen2019-08-121-194/+0
| | | | We can use the hb-based implementation in pangofc-font.c.
* cairo: Render visible space differentlyMatthias Clasen2019-07-251-3/+3
| | | | | | | | | Instead of a [SPC] hex box, just render a centered dot, as is commonly used to indicate space. Also render synthetic glyphs for tabs and newlines. This makes single-paragraph mode prettier.
* cairo: Better hex boxes for ignorablesMatthias Clasen2019-07-251-3/+12
| | | | | | For ignorable characters such as U+00AD, Soft Hyphen, render a hex box with their 'nickname', which is a 2-6 character short form such as SHY.
* cairo: Give missing spaces a better widthMatthias Clasen2019-07-071-0/+46
| | | | | We are not rendering hex boxes for missing spaces, so we don't need to give them the hex box width.
* Remove an unused labelMatthias Clasen2019-07-061-1/+0
|
* Add line height to font metricsMatthias Clasen2019-07-051-14/+24
| | | | Add a getter for the line height of a font.
* Header cleanupMatthias Clasen2019-07-041-0/+1
| | | | | | | Abolish the PANGO_ENABLE_BACKEND and PANGO_ENABLE_ENGINE defines. All backend-only apis are moved into private headers, all apis that were engine-only are marked as deprecated, since engines are.
* Add assertions to guard against division by zero on sample text pathsPhilip Withnall2017-02-141-1/+4
| | | | | | | | | | | | | There are a few code paths where pango_utf8_strwidth() is called on language-specific sample text. The sample text should have been chosen to never have a zero width, but we should add some assertions to ensure that’s the case. This guides static analysers into the right analysis. Coverity IDs: 1391697, 1391698, 1391699 Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=778602
* Bug 695163 - pangocairo hexboxes don't take actual font size into accountBehdad Esfahbod2015-04-301-5/+12
|
* Add many missing nullability annotations.Evan Nemerson2014-10-161-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=731022
* Bug 686512 - pango_cairo_font_get_scaled_font failed under wineBehdad Esfahbod2012-12-091-0/+2
|
* More churnBehdad Esfahbod2012-08-281-2/+2
|
* Bug 652841 - Various pieces of dead code found by gcc/clang static analyzerBehdad Esfahbod2011-06-171-2/+2
|
* Use G_DEFINE_INTERFACE in PangoCairoFontJavier Jardón2011-04-301-28/+6
|
* Bug 636348 - Hex boxes are incorrectly scaled with non identity cairo scaleBehdad Esfahbod2010-12-281-0/+2
|
* [cairo] Scale font metrics to user spaceBehdad Esfahbod2010-05-041-2/+35
| | | | Bug 457990 - font metrics are not converted to user space in cairo backend
* [cairo] Refactor common code in create_metrics_for_context()Behdad Esfahbod2010-05-041-1/+47
|
* TypoBehdad Esfahbod2009-10-051-1/+1
|
* Remove desc argument from _pango_cairo_font_private_initialize(). ReplaceBehdad Esfahbod2009-01-281-2/+2
| | | | | | | | | | | | | | | 2009-01-09 Behdad Esfahbod <behdad@gnome.org> * pango/pangocairo-atsuifont.c (_pango_cairo_atsui_font_new): * pango/pangocairo-fcfont.c (_pango_cairo_fc_font_new): * pango/pangocairo-font.c (_pango_cairo_font_private_initialize): * pango/pangocairo-private.h: * pango/pangocairo-win32font.c (_pango_cairo_win32_font_new): Remove desc argument from _pango_cairo_font_private_initialize(). Replace it with gravity, the only thing from desc we actually needed. This is in preparation for lazy loading of fonts in the pangofc fontmap. svn path=/trunk/; revision=2803
* Remove context argument from _pango_cairo_font_private_initialize().Behdad Esfahbod2009-01-281-5/+2
| | | | | | | | | | | | | | | | 2009-01-09 Behdad Esfahbod <behdad@gnome.org> * pango/pangocairo-atsuifont.c (_pango_cairo_atsui_font_new): * pango/pangocairo-fcfont.c (_pango_cairo_fc_font_new): * pango/pangocairo-font.c (_pango_cairo_font_private_initialize): * pango/pangocairo-private.h: * pango/pangocairo-win32font.c (_pango_cairo_win32_font_new): Remove context argument from _pango_cairo_font_private_initialize(). Replace it with pango_ctm and font_options, the only things from context we actually needed. This is in preparation for lazy loading of fonts in the pangofc fontmap. svn path=/trunk/; revision=2801
* Add more debug info if creating scaled font failed.Behdad Esfahbod2008-12-061-0/+13
| | | | | | | | | | 2008-12-06 Behdad Esfahbod <behdad@gnome.org> * pango/pangocairo-font.c (_pango_cairo_font_private_get_scaled_font): Add more debug info if creating scaled font failed. svn path=/trunk/; revision=2748
* Bug 562574 – Pangocariowin32 is leaking every cairo font it ever createsBehdad Esfahbod2008-11-281-0/+4
| | | | | | | | | | | | | | | | | 2008-11-28 Behdad Esfahbod <behdad@gnome.org> Bug 562574 – Pangocariowin32 is leaking every cairo font it ever creates * pango/pangocairo-atsuifont.c (pango_cairo_atsui_font_finalize): * pango/pangocairo-win32font.c (pango_cairo_win32_font_finalize): Finalize shared pangocairo font resources. Oops! * pango/pangocairo-font.c (_pango_cairo_font_private_finalize): Protect against multiple calls to finalize. This is practiced by the pangocairo-fcfont when a font is shutdown and then finalized. svn path=/trunk/; revision=2746
* Bug 143542 – PangoFT2Fontmap leakBehdad Esfahbod2008-08-221-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make the following API public:Behdad Esfahbod2008-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Bug 474706 – cairo hexbox looks uglyBehdad Esfahbod2008-04-211-3/+4
| | | | | | | | | | | | | 2008-04-21 Behdad Esfahbod <behdad@gnome.org> Bug 474706 – cairo hexbox looks ugly * pango/pangocairo-font.c (_pango_cairo_font_private_get_hex_box_info): Tweak minifont size a bit. Also propagate font options correctly. svn path=/trunk/; revision=2604
* Minor reordering to make debugging easier.Behdad Esfahbod2008-01-251-2/+3
| | | | svn path=/trunk/; revision=2554
* Bug 478914 – Use something invalid instead of '?' when validating inputBehdad Esfahbod2007-12-101-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-12-10 Behdad Esfahbod <behdad@gnome.org> Bug 478914 – Use something invalid instead of '?' when validating input text * pango/pango-layout.c (pango_layout_set_text): Set invalid input bytes to -1, which gives a unichar value of -1, and eventually a glyph value of -1, aka PANGO_GLYPH_INVALID_INPUT. * pango/fonts.c (pango_font_get_glyph_extents), (pango_font_get_metrics), (pango_font_get_font_map): * pango/modules.c (build_map): * pango/pango-context.c (get_script), (get_shaper_and_font), (string_from_script), (itemize_state_process_run): * pango/pango-coverage.c (pango_coverage_get): * pango/pango-impl-utils.h: * pango/pango-utils.c: * pango/pangocairo-font.c (pango_cairo_font_get_scaled_font), (_pango_cairo_font_private_get_hex_box_info), (_pango_cairo_font_private_get_glyph_extents_missing): * pango/pangocairo-private.h: * pango/pangocairo-render.c (_pango_cairo_renderer_draw_frame), (_pango_cairo_renderer_draw_box_glyph), (_pango_cairo_renderer_draw_unknown_glyph): * pango/pangofc-fontmap.c (pango_fc_font_map_get_patterns): * pango/pangoft2-private.h: * pango/pangoft2-render.c (pango_ft2_font_render_box_glyph), (pango_ft2_font_render_glyph), (pango_ft2_renderer_draw_glyph): * pango/pangoft2.c (pango_ft2_font_get_face), (pango_ft2_font_get_glyph_extents): * pango/pangox.c (pango_x_find_subfont), (pango_x_render): * pango/pangoxft-font.c (_pango_xft_font_get_mini_font), (get_glyph_extents_missing), (pango_xft_font_get_font): * pango/pangoxft-private.h: * pango/pangoxft-render.c (get_total_matrix), (draw_box), (_pango_xft_renderer_draw_box_glyph), (_pango_xft_renderer_draw_unknown_glyph), (pango_xft_renderer_draw_glyphs): * pango/shape.c (pango_shape): Render PANGO_GLYPH_INVALID_INPUT to a single-width box with a cross inside. Also cleanup spewed warnings and warn at the source, where we fail to find a shaper, instead of at every location that we see a NULL font. * pango/pango-font.h: * docs/pango-sections.txt: * docs/tmpl/glyphs.sgml: New public macro: PANGO_GLYPH_INVALID_INPUT svn path=/trunk/; revision=2519
* Bug 481537 – compiler warning fixes Patch from Kjartan MaraasBehdad Esfahbod2007-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 2007-10-15 Behdad Esfahbod <behdad@gnome.org> Bug 481537 – compiler warning fixes Patch from Kjartan Maraas * pango/break.c (pango_get_log_attrs): * pango/pango-attributes.c (pango_attr_list_insert_internal): * pango/pango-layout.c (process_item), (justify_clusters): * pango/pango-markup.c (span_parse_boolean): * pango/pango-ot-ruleset.c (pango_ot_ruleset_finalize), (pango_ot_ruleset_new): * pango/pango-utils.c (pango_scan_int): * pango/pangocairo-font.c (_pango_cairo_font_install): * pango/pangofc-font.c (pango_fc_font_create_metrics_for_context): * pango/pangoft2.c (load_fallback_face): * pango/pangox-fontmap.c (pango_x_get_coverage_win): * pango/pangox.c (itemize_string_foreach): Fix warnings. svn path=/trunk/; revision=2444
* Part of Bug 474708 – pangocairo leaks memoryBehdad Esfahbod2007-09-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 2007-09-07 Behdad Esfahbod <behdad@gnome.org> Part of Bug 474708 – pangocairo leaks memory * pango/pangocairo-font.c (_pango_cairo_font_private_get_hex_box_info): Fix a couple leaks. * pango/pangocairo-atsui.h: * pango/pangocairo-atsuifontmap.c (pango_cairo_atsui_font_map_finalize): * pango/pangocairo-fc.h: * pango/pangocairo-fcfontmap.c (pango_cairo_fc_font_map_finalize): * pango/pangocairo-win32.h: * pango/pangocairo-win32fontmap.c (pango_cairo_win32_font_map_finalize): Remove unused leftover renderer variable. * pango/pangofc-fontmap.c (pango_fc_font_map_finalize): Fix thinko. svn path=/trunk/; revision=2424
* Part of Bug 347236 – provide pango_cairo_font_get_scaled_fontBehdad Esfahbod2007-07-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 2007-07-21 Behdad Esfahbod <behdad@gnome.org> Part of Bug 347236 – provide pango_cairo_font_get_scaled_font * docs/Makefile.am: * docs/pango-sections.txt: * docs/tmpl/atsui-fonts.sgml: * docs/tmpl/opentype.sgml: * docs/tmpl/pango-engine-lang.sgml: * docs/tmpl/pango-engine-shape.sgml: * docs/tmpl/pangocairo.sgml: * pango/pangoatsui.h: * pango/pangocairo-atsuifont.h: * pango/pangocairo-font.c (pango_cairo_font_get_scaled_font): * pango/pangocairo-private.h: * pango/pangocairo.h: Export PangoCairoFont and cleanup various standard macros. svn path=/trunk/; revision=2375
* Check for NULL before dereferencing. Patch from Keith Packard.Behdad Esfahbod2007-06-141-2/+5
| | | | | | | | | | | 2007-06-14 Behdad Esfahbod <behdad@gnome.org> * pango/pangocairo-font.c (_pango_cairo_font_private_scaled_font_data_destroy): Check for NULL before dereferencing. Patch from Keith Packard. svn path=/trunk/; revision=2354
* Bug 347236 – provide pango_cairo_font_get_scaled_font Bug 347235 – AddBehdad Esfahbod2007-06-111-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-06-10 Behdad Esfahbod <behdad@gnome.org> Bug 347236 – provide pango_cairo_font_get_scaled_font Bug 347235 – Add pango_cairo_font_map_get_font_type Bug 353291 – Provide pango_cairo_font_map_new_for_font_type * pango/pangocairo-font.c: New public API: pango_cairo_font_get_scaled_font() * pango/pangocairo-fontmap.c: New public API: pango_cairo_font_map_new_for_font_type() pango_cairo_font_map_get_font_type() * pango/pangocairo-fcfontmap.c: Implement get_font_type() method. * pango/pangocairo.h: * pango/pangocairo-private.h: * docs/pango-sections.txt: * docs/tmpl/pangocairo.sgml: * pango/pangocairo.def: Update. svn path=/trunk/; revision=2336
* Bug 337593 – move glyph extents code (and cache) from pangocairo-*font.cBehdad Esfahbod2007-06-101-67/+439
| | | | | | | | | | | | | | | | | | | | | | | | | 2007-06-09 Behdad Esfahbod <behdad@gnome.org> Bug 337593 – move glyph extents code (and cache) from pangocairo-*font.c into pangocairo-font.c * pango/pangocairo-fontmap.c: * pango/pangocairo-fcfontmap.c: Remove per-fontmap renderer. We've not been using it for a while and there is no reason to use it. * pango/pangocairo-font.c * pango/pangocairo-fcfont.c: Most most code (including glyph extents caching) from fcfont.c to font.c. Simplifies individual backends a lot. ATSUI and Win32 cairo backends should adapt. * pango/pangocairo-render.c * pango/pangocairo-private.h: Update to reflect above changes. svn path=/trunk/; revision=2335
* Zero glyphs->num_glyphs before calling into shape engine.Behdad Esfahbod2007-06-051-1/+7
| | | | | | | | | | | | | | | | | | 2007-06-04 Behdad Esfahbod <behdad@gnome.org> * pango/shape.c (pango_shape): Zero glyphs->num_glyphs before calling into shape engine. * pango/pango-engine.c (fallback_engine_shape): Improve, to support clusters and what not. * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): Use "pango_script_get_sample_language (PANGO_SCRIPT_LATIN)" instead of hardcoding "en". Handle cairo_scaled_font_extents() failure. svn path=/trunk/; revision=2332