summaryrefslogtreecommitdiff
path: root/pango/shape.c
Commit message (Collapse)AuthorAgeFilesLines
* shape: Don't crash if log_attrs is NULLavoid-shape-crashMatthias Clasen2022-10-021-4/+17
| | | | | | | | | We accept NULL for log_attrs, so we should not crash when we are given NULL. While fixing this, clarify the documentation of the various shaping APIs for what they can and cannot do. Related: !641
* fix thread safety problemmisos12022-07-311-7/+8
|
* shape: More tweaks to space handlingMatthias Clasen2021-12-171-4/+16
| | | | | | | | | | | | | | It is a difficult dance between HarfBuzz and pango which glyphs we let hb synthesize, and which ones we need to fake ourselves. HarfBuzz knows how to create other spaces from 0x20, so if the font is lacking spaces, we want to tell HarfBuzz that we don't have that glyph *except* for 0x20 where we need to fake one, and provide HarfBuzz with a suitable width. Update affected tests.
* Revert "Fix advance widths with transforms"fix-vertical-regressionMatthias Clasen2021-12-171-16/+29
| | | | | | | | | This reverts commit ccb651dd2a876a4f4a4cb9351f05332173e709ba. This broke vertical text rendering, see https://gitlab.com/inkscape/inkscape/-/issues/2950. Update affected tests and add a vertical test.
* Fix handling of space-less fontsfix-spaceless-fontsMatthias Clasen2021-12-161-1/+9
| | | | | | | | | | | HarfBuzz knows how to synthesize spaces, we just need to tickle it in the right way. Test included. Update affected tests. Fixes: #641
* Never show variation selectorsMatthias Clasen2021-11-281-2/+5
| | | | | | | | Even when we show ignorables, we still want to ignore variation selectors and other ignorables that we don't have nicks for. Test included.
* Fix misplaced glyphs in gravity eastMatthias Clasen2021-11-271-1/+4
| | | | | This was showing up as glyphs placed outside their logical extents.
* Fix visible space handlingMatthias Clasen2021-11-241-3/+5
| | | | | Make space actually show up as visible space when we want that.
* shape: Be consistent when getting text transformsMatthias Clasen2021-11-071-2/+3
| | | | We want last-one-wins semantics here.
* shape: Use the new helperMatthias Clasen2021-11-061-68/+2
|
* Fix advance widths with transformsadvance-transformMatthias Clasen2021-11-051-29/+13
| | | | | | | | | | The hb_font_t we were passing to Harfbuzz for shaping was not taking context transforms into account, and therefore was not scaling advance widths as necessary. Always go through pangos glyph extents to fix this. Fixes: #620
* CosmeticsMatthias Clasen2021-10-261-6/+6
| | | | Fold markers always just use 3 {, even when nested.
* shape: Mark color glyphs in glyphstringsMatthias Clasen2021-09-011-0/+43
| | | | | GTK needs this information to decide how to render the glyphs, so provide it.
* Refine hyphenationMatthias Clasen2021-08-251-10/+24
| | | | | | | | Replace ‧ and | with a - when we break there. Update affected test output. Fixes: #603
* shape: Rearrange hb buffer setupMatthias Clasen2021-08-251-8/+7
| | | | | Rearrange the buffer setup code slightly, so that we can change it easier, later.
* Documentation tweaksMatthias Clasen2021-08-201-27/+28
|
* shaping: implement text transformMatthias Clasen2021-08-201-81/+167
| | | | | | Transform the text we hand to harfbuzz, as prescribed by the text transform attributes we have. This uses the log attrs to find word starts.
* Add pango_shape_itemMatthias Clasen2021-08-201-38/+94
| | | | | | Add a pango_shape API variant that takes log attrs, so we can implement text transforms that depend on word boundaries, in the future.
* CosmeticsMatthias Clasen2021-08-201-17/+17
| | | | Streamline the internals of shape.c a bit.
* Some more code reorgMatthias Clasen2021-08-201-81/+496
| | | | | We use harfbuzz shaping on all platforms now, so just merge the code into shape.c
* Add check for a NULL font in PangoAnalysis structureLuca Bacci2021-08-111-1/+1
| | | | Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/592
* pango/shape.c: Use the former rounding code as neededChun-wei Fan2021-08-091-0/+12
| | | | | | | | | | The careful rounding code that was brought back as a result of commit d4356779 only had effect if we are using a backend that supported font hinting, so on other backends, use the former rounding code that was dropped in favor of the careful rounding code that unfortunately did not apply for all backends. Should fix #578.
* Clean up rounding codeprivate-vfuncsMatthias Clasen2021-07-311-54/+26
| | | | | | Add private api to get the necessary information from the font backend, and drop the hack that was added in d4356779945855f7cc.
* shape: Bring back careful rounding codebring-back-better-roundingMatthias Clasen2021-06-271-4/+73
| | | | | | | | | | | | | | | | When we added the round-glyph-positions option in c43da2d3 and b5634799, we lost some code that was careful to round in device coordinates. The reason we lost it is that the rounding needs fontconfig- specific data that is only available in the backend, and the rounding now happens in the frontend. Bringing it back is annoying, since we've run out of vfunc slots to get info from the backend. This commit works around that limitation in a hacky way. Fixes: #562
* introspection: Stop using allow-noneMatthias Clasen2021-05-191-2/+2
| | | | | The allow-none annotation has been deprecated for a long time already. Instead use optional and nullable everywhere.
* docs: Tweak shaping docsMatthias Clasen2021-03-111-42/+36
| | | | Add summaries, convert markup, etc.
* 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
* Add a pango_shape variant that takes flagsMatthias Clasen2019-08-031-22/+71
| | | | | The only flag currently defined affects whether glyph positions are rounded or not.
* Remove unused remnants of shape engineKhaled Hosny2019-07-191-1/+0
|
* Rename _pango_fc_shapeMatthias Clasen2019-07-181-5/+5
| | | | It is all harfbuzz now, so call it pango_hb_shape.
* Switch to using harfbuzz for shapingMatthias Clasen2019-07-181-61/+73
| | | | | | Drop internal shape engine uses and call _pango_fc_shape directly. This makes us use harfbuzz for shaping, on all backends.
* Some more doc tweaksMatthias Clasen2019-07-141-1/+1
|
* Fix introspection annotationEmmanuele Bassi2014-06-201-1/+1
| | | | Missing colon broke the g-ir-scanner.
* Bug 685167 - migrate docs to no-tmpl flavourBehdad Esfahbod2013-09-271-0/+10
| | | | Patch from Rafał Mużyło.
* Add pango_shape_full()Behdad Esfahbod2012-09-261-5/+58
| | | | | | | | | | | | | | | | Variant of pango_shape() that takes the full paragraph text as input. This is then passed in entirety to HarfBuzz, which would allow certain cross-run interactions (in Arabic for example). When combined with upcoming HarfBuzz 0.9.5+, this fixes: Red Hat Bug 858736 - [Spanish] Stray dotted circle rendered https://bugzilla.redhat.com/show_bug.cgi?id=858736 and partially: Bug 313181 - color changes break arabic shaping https://bugzilla.gnome.org/show_bug.cgi?id=313181
* More churnBehdad Esfahbod2012-08-281-1/+1
|
* Bug 596614 - Pango application receives SIGSEGV on pasting text with U+202EBehdad Esfahbod2009-11-171-3/+31
| | | | | Fixed all modules to reverse glyphs if run is rtl. Except for Hangul module. Fixed pango_shape() to detect that, warn, and reverse.
* 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 478914 – Use something invalid instead of '?' when validating inputBehdad Esfahbod2007-12-101-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 466755 – pango hangul is crashing in gnome-about because it isBehdad Esfahbod2007-08-141-13/+33
| | | | | | | | | | | | | | | | | 2007-08-14 Behdad Esfahbod <behdad@gnome.org> Bug 466755 – pango hangul is crashing in gnome-about because it is failing to retrieve a font. * pango/pangofc-font.c (pango_fc_font_real_get_glyph), (pango_fc_font_kern_glyphs), (pango_fc_font_get_raw_extents): Protect against NULL face. * pango/shape.c (pango_shape): Improve error message by writing out shaping engine type name and the text too. svn path=/trunk/; revision=2396
* Zero glyphs->num_glyphs before calling into shape engine.Behdad Esfahbod2007-06-051-0/+2
| | | | | | | | | | | | | | | | | | 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
* *.c, *.h: Replace preceding sequences of 8 spaces with tabs.Behdad Esfahbod2007-01-161-6/+6
| | | | | | | | | 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-5/+5
| | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> *.c, *.h: Drop trailing whitespace. svn path=/trunk/; revision=2163
* Remove unnecessary 'static' in type definition that causes a relocation.Behdad Esfahbod2006-09-131-1/+3
| | | | | | | | | 2006-09-13 Behdad Esfahbod <behdad@gnome.org> * pango/pango-engine.h: Remove unnecessary 'static' in type definition that causes a relocation. * pango/shape.c (pango_shape): Make sure last_cluster is invalid.
* Oops, undo stuff that were committed accidentally.Behdad Esfahbod2006-09-131-3/+1
|
* Part of Bug 355782 – Misaligned extents in pangoBehdad Esfahbod2006-09-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | 2006-09-13 Behdad Esfahbod <behdad@gnome.org> Part of Bug 355782 – Misaligned extents in pango * pango/pango-layout.c (cluster_width): Rewrite based on is_cluster_start instead of accessing log_clusters directly. This is more robust as next_cluster uses that, so the two match now. * pango/pango-layout.c (update_cluster): Remove the cluster_start_index parameter and use iter->cluster_start instead. * pango/pango-layout.c (pango_layout_iter_copy): Fix typo in copying iter->cluster_width. * pango/pango-layout.c (pango_layout_iter_get_cluster_extents): Add an assert to make sure iter->cluster_width is correctly set. * pango/pango-layout.c (pango_layout_iter_get_char_extents): Remove assert that was readded above to check more cases.
* Fix handling of WEST and EAST gravity effect on bidi level.Behdad Esfahbod2006-08-151-2/+13
| | | | | | | | | | | | | | | | | 2006-08-15 Behdad Esfahbod <behdad@gnome.org> * pango/pango-context.c (itemize_state_add_character): Fix handling of WEST and EAST gravity effect on bidi level. * pango/pangocairo-fcfont.c (pango_cairo_fc_font_glyph_extents_cache_init): For NORTH gravity (upside down text), swap ascent and descent, and for EAST/WEST, center baseline between ascent/descent. * pango/shape.c (pango_shape): If glyph width is negative, negate it and shift glyph by that amount. This allows having font matrices that essentially move the glyph origin to the right of the glyph to still work.
* Change g_critical to g_warning. We already handle them gracefully.Behdad Esfahbod2006-02-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 2006-02-21 Behdad Esfahbod <behdad@gnome.org> * pango/fonts.c, pango/glyphstring.c, pango/pango-fontmap.c, pango/pango-ot-buffer.c, pango/pangocairo-font.c, pango/pangoft2.c, pango/pangoxft-font.c, pango/shape.c: Change g_critical to g_warning. We already handle them gracefully. Bug 331994 – --disable-debug removes G_DISABLE_CAST_CHECKS Patch from charlet@act-europe.fr * configure.in: Do not lose PANGO_DEBUG_FLAGS when reassigning. Bug 331995 – pango_layout_set_text optimization Patch from charlet@act-europe.fr * pango/pango-layout.c: Do not validate input text if asserts are disabled. Moreover, do not truncate input text on invalid sequence. Bug 331996 – avoid crashes in win32 font handling Patch from charlet@act-europe.fr * pango/pangofc-fontmap.c, pango/pangowin32-fontmap.c, pango/pangowin32.c: if (!font) return NULL in a number of places.
* Bug 314548 – pango_shape() is missing const correctness Patch fromBehdad Esfahbod2006-02-091-1/+1
| | | | | | | | | | | | | | | | | | 2006-02-09 Behdad Esfahbod <behdad@gnome.org> Bug 314548 – pango_shape() is missing const correctness Patch from Antoine Dopffer. * modules/arabic/arabic-fc.c, modules/basic/basic-fc.c, modules/basic/basic-x.c, modules/hangul/hangul-fc.c, modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c, modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c, modules/thai/thai-shaper.c, modules/thai/thai-shaper.h, modules/tibetan/tibetan-fc.c, pango/pango-context.c, pango/pango-engine-private.h, pango/pango-engine.c, pango/pango-engine.h, pango/pango-glyph.h pango/pango-layout.c, pango/shape.c: Make PangoAnalysis *analysis const in all shaper interfaces.
* Warn only once per font-description that cannot be loaded.Behdad Esfahbod2006-02-061-2/+2
| | | | | | | | | | 2006-02-06 Behdad Esfahbod <behdad@gnome.org> * pango/pango-fontmap.c (pango_font_map_real_load_fontset): Warn only once per font-description that cannot be loaded. * pango/pangox.c: Make it not crash if no font found, like other backends.