summaryrefslogtreecommitdiff
path: root/pango/shape.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Finish the 'glyph 0' work of this morning: PANGO_GLYPH_NULL that IBehdad Esfahbod2006-02-031-26/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-02-02 Behdad Esfahbod <behdad@gnome.org> Finish the 'glyph 0' work of this morning: PANGO_GLYPH_NULL that I introduced is renamed to PANGO_GLYPH_EMPTY. It means, no rendering should be performed. The backends however, still return 0 if a glyph is not found. The modules then are free to replace this 0 glyph with an unknown character. * modules/arabic/arabic-fc.c, modules/basic/basic-atsui.c, modules/basic/basic-fc.c, modules/basic/basic-win32.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-fc.c, modules/tibetan/tibetan-fc.c, pango/pangox.c, pango/pangowin32.c: Adapt to above change. Backends return 0 if glyph not found. * pango/fonts.c (pango_font_get_glyph_extents): If font is not usable (!PANGO_IS_FONT (font)), return the generic UNKNOWN_GLYPH metrics. This is used when your backends are misconfigured and you don't find *any* font at all. * pango/pango-engince.c: Add unknown glyphs in fallback shaper, instead of empty glyphs. * pango/shape.c: Call the fall-back shaper if shaper fails, instead of generating a dummy glyph string ourselves. * pango/pango-layout.c (imposed_shape, shape_tab): Use PANGO_GLYPH_EMPTY instead of glyph 0. * pango/pango-renderer.c (pango_renderer_draw_glyph): No-op on PANGO_GLYPH_EMPTY instead of glyph 0. * pango/pangocairo-atsuifont.c, pango/pangocairo-win32font.c, pango/pangocairo-fcfont.c, pango/pangocairo-font.c, pango/pangocairo-private.h: install_font returns a boolean now. * pango/pangocairo-render.c, pango/pangoxft-render.c: Handle font and hex-box failures more gracefully by drawing a generic unknown-box glyph. * pango/pangoft2.c, pango/pangoft2-render.c: Draw the generic unknown-box glyph here too. For unknown glyphs though, if the font is TTF (FT_IS_SFNT), use the zero-indexed glyph, otherwise, draw a box of proper size.
* Oops!Behdad Esfahbod2006-02-021-1/+0
|
* Use PANGO_GLYPH_NULL for when no glyph should be drawn. UseBehdad Esfahbod2006-02-021-3/+12
| | | | | | | | | | | | | | | | | | | | | | | 2006-02-02 Behdad Esfahbod <behdad@gnome.org> * modules/arabic/arabic-fc.c, modules/basic/basic-atsui.c, modules/basic/basic-fc.c, modules/basic/basic-win32.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-fc.c, modules/tibetan/tibetan-fc.c, pango/fonts.c, pango/pango-engine-private.h pango/pango-types.h, pango/pangocairo-fcfont.c, pango/pangocairo-font.c, pango/pangocairo-private.h, pango/pangocairo-render.c, pango/pangofc-decoder.c, pango/pangofc-font.c, pango/pangoft2-render.c, pango/pangoft2.c pango/pangowin32.c, pango/pangox.c, pango/pangoxft-font.c pango/pangoxft-private.h, pango/pangoxft-render.c, pango/shape.c: Use PANGO_GLYPH_NULL for when no glyph should be drawn. Use PANGO_GLYPH_UNKNOWN_FLAG for all backends to mark unknown flags. There's no need for pango_font_get_unknown_glyph() anymore, since all backends know how to handle PANGO_GLYPH_UNKNOWN_FLAG gracefully. We may add that in the future however. (fixes bug #73147, closes bug #329524)
* Improve error handling in high-frequency functions: Only warn once.Behdad Esfahbod2006-01-311-13/+10
| | | | | | | | | | | | | | | 2006-01-30 Behdad Esfahbod <behdad@gnome.org> * pango/shape.c (pango_shape): * pango/fonts.c (pango_font_get_glyph_extents): * pango/pangocairo-font.c (_pango_cairo_font_install): Improve error handling in high-frequency functions: Only warn once. * pango-impl-utils.h, pangoutils.h: * pangocairo-private.h, pangocairo-font.c: Add machinery for above: _pango_warning_history and _pango_cairo_warning_history.
* Oops, removed all my changes the other time :(Behdad Esfahbod2006-01-301-3/+21
| | | | | | | | | | | | 2006-01-30 Behdad Esfahbod <behdad@gnome.org> Bug 328314 – Examples should use GOption instead of argcontext.c Patch from Antoine Dopffer. * examples/renderdemo.c: Use GOption for parsing cmd-line options. * examples/argcontext.c, examples/argcontext.h: Removed.
* Do not crash if the (win32 typically) shaper fails. Bug #304702:Behdad Esfahbod2006-01-291-8/+13
| | | | | | | | | | | | | | | | 2006-01-29 Behdad Esfahbod <behdad@gnome.org> Do not crash if the (win32 typically) shaper fails. Bug #304702: * pango/pango-engine.c (_pango_engine_shape_shape): Set num_glyphs to zero if failing. * pango/pango-shape.c (pango_shape): Instead of crashing if the shaper failed to produce any glyphs, print out a warning message containing the name of the font, and mark the font such that we don't keep printing warning for the same font. Moreover, inject one whitespace glyph per character, so you just see nothing, but everything works otherwise.
* Do not crash if the (win32 typically) shaper fails. Bug #304702:Behdad Esfahbod2006-01-291-5/+39
| | | | | | | | | | | | | | 2006-01-29 Behdad Esfahbod <behdad@gnome.org> Do not crash if the (win32 typically) shaper fails. Bug #304702: * pango/pango-engine.c (_pango_engine_shape_shape): Set num_glyphs to zero if failing. * pango/pango-shape.c (pango_shape): Instead of crashing if the shaper failed to produce any glyphs, print out a warning message containing the name of the font, and mark the font such that we don't keep printing warning for the same font.
* Make sure #include <config.h> is the first include in the file. (bugBehdad Esfahbod2006-01-141-0/+1
| | | | | | | 2006-01-14 Behdad Esfahbod <behdad@gnome.org> * */*.c, */*/*.c: Make sure #include <config.h> is the first include in the file. (bug #158870, based on patch by Luis Menina)