src/hb-graphite2.cc

Branch


Log

Author Commit Date CI Message
Khaled Hosny 880eb464 2025-08-04T00:57:48 [graphite2] Use signed int for current advance Graphite can return negative advances, but we were storing current x and y advances as unsigned ints. The `curradvx` and `curradvy` variables are used only when calculating the respective offset, but the advance itself it always taken from Graphite directly, so using signed here makes no difference to how advances are set, only the offsets. Fixes https://github.com/harfbuzz/harfbuzz/issues/5439
Behdad Esfahbod 4807a021 2025-03-12T18:27:27 [atomic] Kill hb_atomic_ptr_t<T> Use hb_atomic_t<T *> instead.
Khaled Hosny c650858c 2023-07-08T13:57:05 [graphite] Fix cluster advance width Based on https://github.com/harfbuzz/harfbuzz/issues/4309#issuecomment-1624730406 Fixes https://github.com/harfbuzz/harfbuzz/issues/4309
Behdad Esfahbod b130b2b3 2023-02-24T13:34:16 [graphite] Simplify direction handling
Behdad Esfahbod cbc71c56 2023-02-24T13:15:11 [graphite] Ensure native direction Mirrored characters come out wrong. Oh well. Better than before though.
Behdad Esfahbod ae981eec 2023-02-23T21:36:17 [graphite] Remove script handling https://github.com/harfbuzz/harfbuzz/issues/3439#issuecomment-1442650148
Behdad Esfahbod ac0efaf8 2022-11-22T12:50:36 Use hb_memset instead of memset consistently
Behdad Esfahbod 5744e951 2022-07-18T14:54:44 [gir] Skip graphite API Fixes https://github.com/harfbuzz/harfbuzz/issues/2557
Stephan Bergmann 14b01812 2021-08-09T17:17:48 hb_graphite2_cluster_t::advance can apparently be negative ...as seen with HarfBuzz used by LibreOffice, with `instdir/program/soffice --headless --convert-to pdf` of doc/abi6073-2.doc from the LibreOffice crash- testing corpus when run under UBSan, > hb-graphite2.cc:361:15: runtime error: -1024 is outside the range of representable values of type 'unsigned int' > #0 in _hb_graphite2_shape at workdir/UnpackedTarball/harfbuzz/src/hb-graphite2.cc:361:15 > #1 in _hb_shape_plan_execute_internal(hb_shape_plan_t*, hb_font_t*, hb_buffer_t*, hb_feature_t const*, unsigned int) at workdir/UnpackedTarball/harfbuzz/src/./hb-shaper-list.hh:38:1 > #2 in hb_shape_plan_execute at workdir/UnpackedTarball/harfbuzz/src/hb-shape-plan.cc:453:14 > #3 in hb_shape_full at workdir/UnpackedTarball/harfbuzz/src/hb-shape.cc:139:19 > #4 in GenericSalLayout::LayoutText(ImplLayoutArgs&, SalLayoutGlyphsImpl const*) at vcl/source/gdi/CommonSalLayout.cxx:495:23 > #5 in OutputDevice::getFallbackLayout(LogicalFontInstance*, int, ImplLayoutArgs&, SalLayoutGlyphs const*) const at vcl/source/outdev/font.cxx:1232:21 > #6 in OutputDevice::ImplGlyphFallbackLayout(std::unique_ptr<SalLayout, std::default_delete<SalLayout> >, ImplLayoutArgs&, SalLayoutGlyphs const*) const at vcl/source/outdev/font.cxx:1300:48 > #7 in OutputDevice::ImplLayout(rtl::OUString const&, int, int, Point const&, long, long const*, SalLayoutFlags, vcl::TextLayoutCache const*, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1332:22 > #8 in lcl_CreateLayout(SwTextGlyphsKey const&, __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<SwTextGlyphsKey const, SwTextGlyphsData> >, std::__debug::map<SwTextGlyphsKey, SwTextGlyphsData, std::less<SwTextGlyphsKey>, std::allocator<std::pair<SwTextGlyphsKey const, SwTextGlyphsData> > >, std::bidirectional_iterator_tag>) at sw/source/core/txtnode/fntcache.cxx:233:33 > #9 in SwFntObj::GetCachedSalLayoutGlyphs(SwTextGlyphsKey const&) at sw/source/core/txtnode/fntcache.cxx:257:12 > #10 in SwFont::GetTextBreak(SwDrawTextInfo const&, long) at sw/source/core/txtnode/fntcache.cxx:2551:58 > #11 in SwTextSizeInfo::GetTextBreak(long, o3tl::strong_int<int, Tag_TextFrameIndex>, unsigned short, vcl::TextLayoutCache const*) const at sw/source/core/text/inftxt.cxx:450:20 > #12 in SwTextGuess::Guess(SwTextPortion const&, SwTextFormatInfo&, unsigned short) at sw/source/core/text/guess.cxx:205:26 > #13 in SwTextPortion::Format_(SwTextFormatInfo&) at sw/source/core/text/portxt.cxx:305:32 > #14 in SwTextPortion::Format(SwTextFormatInfo&) at sw/source/core/text/portxt.cxx:456:12 > #15 in SwLineLayout::Format(SwTextFormatInfo&) at sw/source/core/text/porlay.cxx:260:31 (where in frame #4 GenericSalLayout::LayoutText, pHbBuffer->props.direction is HB_DIRECTION_RTL, in case that is relevant). It is unclear to me whether it is sufficient to only change hb_graphite2_cluster_t::advance from signed to unsigned int, as there are other unsigned int variables (like curradv in _hb_graphite2_shape) whose value depend on hb_graphite2_cluster_t::advance, and which thus might also become negative. But unlike the float -> unsigned int conversion that UBSan warned about here (where gr_slot_origin_X() and xscale are float), those are signed int -> unsigned int conversions that do not cause undefined behavior. At least, with this change, the above --convert-to pdf and a full `make check screenshot` succeeded for me under without further UBSan warnings. (For the version of HarfBuzz optionally built as part of the LibreOffice build, this has been addressed with <https://git.libreoffice.org/core/+/6e53e03f752c2f85283c4d47efaaf0683299783c%5E!/> "external/harfbuzz: hb_graphite2_cluster_t::advance can apparently be negative.")
Khaled Hosny 98e90cc6 2022-06-30T08:43:57 [docs] Reduce warnings Use markdown syntax for inline code blocks instead of %true, %false, and %NULL.
Behdad Esfahbod 20031ddb 2022-01-22T11:41:30 [unsafe-to-concat] Mark in all other shapers unsafe_to_break() implies unsafe-to-concat; but setting the flag manually wasn't.
Behdad Esfahbod 94d43c00 2021-12-04T16:56:39 [buffer] Merge and rename clear_glyph_flags()
Behdad Esfahbod 2337f0d0 2021-07-08T10:58:50 Internally use hb_malloc/.../hb_free instead of malloc/.../free Redefining those stock names as macros was conflicting with gcc 10 headers. Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
Peter Williams 3d48bfc1 2021-06-02T23:12:53 Avoid a deprecation warning in graphite2 As of graphite2 1.3.7, `gr_make_face` is deprecated in favor of `gr_make_face_with_ops`. It's a one-liner to port over to using it. This is potentially a compatibility break since I'm not sure when the `with_ops` API was added, but the minimum version of graphite2 that's supported by Harfbuzz doesn't seem to be documented anywhere anyway.
Behdad Esfahbod 05d2d37f 2021-03-15T13:43:29 [buffer] HB_NODISCARD ensure()
Khaled Hosny 478d169c 2020-12-31T18:17:33 [docs] Document more deprecated symbols
Behdad Esfahbod a11db0b9 2020-04-23T15:32:43 Merge branch 'master' into usermanual-integration
n8willis fb9d1067 2020-04-13T15:14:42 Update src/hb-graphite2.cc Co-Authored-By: Khaled Hosny <dr.khaled.hosny@gmail.com>
n8willis a199eab2 2020-04-13T15:14:28 Update src/hb-graphite2.cc Co-Authored-By: Khaled Hosny <dr.khaled.hosny@gmail.com>
Evgeniy Reizner b79ceac3 2019-12-15T16:50:01 Prefer UINT_MAX instead of uint overflow. Also, prefer HB_FEATURE_GLOBAL_START and HB_FEATURE_GLOBAL_END.
Ebrahim Byagowi a0b4ac4d 2019-08-24T17:57:14 Turn 8 spaces to tab across the project According to the current code style of the project
Behdad Esfahbod 4730b350 2019-07-12T15:38:35 Revert "Update Graphite API to latest (#1215)" This reverts commit e4e74c2751ac24178086cce2811d34d8019b6f85. See https://github.com/harfbuzz/harfbuzz/issues/1829
Behdad Esfahbod aa3450ca 2019-06-17T22:41:49 [config] Don't compile disabled features This makes it possible to include all .cc files into build, even if not building CoreText, Uniscribe, etc. This was mostly to help custom builders. But also means that we can include all files in our own build system. Not sure if we should. Definitely simplifies things, but slightly only.
Nathan Willis d00a20be 2019-05-20T17:38:38 [Docs] Add gtk-doc comments to hb-graphite2.
Behdad Esfahbod 68e12e68 2019-05-13T17:28:59 Fix more semi-colon issues
Behdad Esfahbod fca27860 2019-05-11T00:37:01 [config] Make HB_DISABLE_DEPRECATED actually compile Part of https://github.com/harfbuzz/harfbuzz/issues/1652
Martin Hosken 72962420 2019-03-04T11:12:21 Fix offset drift in graphite integration
Martin Hosken 731b13e4 2019-03-04T11:12:21 Fix offset drift in graphite integration
Behdad Esfahbod ce5da0f3 2018-11-16T02:29:13 [shaper] Rewrite shaper data code to be more template-driven than macro-driven
Behdad Esfahbod f521a28b 2018-11-11T21:32:01 Embed hb_ot_shape_plan_t into hb_shape_plan_t No other shaper will need shape_plan_data, by definition. So, remove abstraction layer and always create hb_ot_shape_plan_t as part of hb_shape_plan_t.
Behdad Esfahbod 1beacdde 2018-11-11T16:35:28 Minor
Behdad Esfahbod f6fc5574 2018-11-05T13:23:54 Add pointer magic operators to hb_atomic_ptr_t
Behdad Esfahbod 04981ee0 2018-10-27T04:40:43 [docs] More
Behdad Esfahbod 46072b7c 2018-10-27T04:21:20 [ot] Fold hb-ot-tag.h into hb-ot-layout.h
Behdad Esfahbod 39bd07ae 2018-10-26T21:01:11 Fix bunch of unused parameter warnings Show up with gcc -O0. There's a few more but those are functions that need to be filled in. Maybe this is a lost battle...
David Corbett 1e816d62 2018-10-11T20:37:49 Fix Indic script tags in Graphite
Behdad Esfahbod ec8f493b 2018-10-11T20:15:00 [graphite] Remove assert
Behdad Esfahbod 4f9e36e8 2018-10-11T14:32:59 [graphite] Remove deprecated symbol use
Behdad Esfahbod 4d205f04 2018-10-11T14:25:48 [graphite] Fix deva/dev2 resolution See https://github.com/harfbuzz/harfbuzz/pull/730#issuecomment-428277800
mhosken e4e74c27 2018-10-04T02:33:26 Update Graphite API to latest (#1215)
Behdad Esfahbod c77ae408 2018-08-25T22:36:36 Rename hb-*private.hh to hb-*.hh Sorry for the noise, downstream custom builders. Please adjust.
Behdad Esfahbod 1f738094 2018-08-09T00:22:37 [atomic] Add hb_atomic_ptr_t<> and port all uses Found and fixed a couple bugs. Found a couple multithreading issues. Marked them with "XXX-MT-bug".
Behdad Esfahbod d4d1bf81 2018-08-02T02:04:02 Fix for recent rename
Behdad Esfahbod 3d22aefe 2018-08-01T18:03:32 Rename
Ebrahim Byagowi 09d5e546 2018-04-11T17:41:48 [graphite] Use tabs instead 8 spaces (#965)
Ebrahim Byagowi d3a432a7 2018-03-30T04:58:47 [graphite] Make get_table threadsafe (#931)
David Corbett 21646cc4 2018-02-16T12:08:55 Do not mark the first glyph as unsafe to break Fixes #791.
Bruce Mitchener 90218fa9 2018-01-31T20:44:45 Fix typos.
Behdad Esfahbod e4da3802 2017-11-10T17:14:27 [coretext/uniscribe/directwrite/graphite/fallback] Update for unsafe-to-break Fixes https://github.com/behdad/harfbuzz/issues/615 We'll see which bots I broke.
Martin Hosken 4de03a15 2017-11-10T13:47:38 Fix graphite intergration reordered clusters problem
Behdad Esfahbod dbdbfe3d 2017-10-15T12:11:08 Use nullptr instead of NULL
mhosken 66128d3c 2017-09-27T01:29:45 Fix missing xscale in rtl graphite unpacking (#541) * Fix missing xscale in rtl graphite unpacking * Oops didn't need to mess with yscale
Behdad Esfahbod 219af509 2017-08-13T15:10:26 [graphite2] Fix warning
Behdad Esfahbod 239119a6 2017-08-13T15:08:34 [unsafe-to-break] Mark all positions as unsafe in alternative shapers
mhosken 74b99ef2 2017-04-20T19:13:22 Fix graphite2 rtl conversion (#475)
Behdad Esfahbod c8dfed8e 2017-02-08T14:36:18 Merge pull request #357 from khaledhosny/graphite-scale [graphite] Fix shaping with varying font sizes
Behdad Esfahbod 466b3e58 2017-02-03T16:43:25 Shuffle things around a bit
Khaled Hosny 1b00a3b0 2016-10-30T20:16:41 [graphite] Fix shaping with varying font sizes Shape using design units and scale the output. See https://bugs.documentfoundation.org/show_bug.cgi?id=103403#c7
Khaled Hosny b435c7c4 2016-11-11T02:16:39 [graphite] Stop creating unused gr_face It is unused after previous commit, hb_graphite2_font_get_gr_font() makes no sense now so deprecating it.
Behdad Esfahbod 72ada4f0 2016-09-10T03:57:24 [GX] Hook up feature variations Shape-plan caching is not implemented.
Martin Hosken 146fe252 2016-01-16T17:24:00 Refactor graphite2 to make ovleraps into negative width spaces
Martin Hosken 1979f6fe 2015-11-23T10:03:56 Fix y_scale problems in hb-gr
Behdad Esfahbod b8811429 2015-09-03T15:53:22 Fix Since tags Fixes https://github.com/behdad/harfbuzz/issues/103
Behdad Esfahbod 97d7c3a1 2015-07-22T14:28:25 [graphite2] Fix bunch of stuff Based on patch from Martin Hosken, with review from Jonathan and I.
Behdad Esfahbod ea7f8414 2015-07-22T13:53:45 [graphite2] Enlarge buffer for output glyphs!
Behdad Esfahbod 15c633dd 2014-08-11T13:42:42 Minor
Behdad Esfahbod 6ae13f25 2014-05-30T17:38:14 [graphite2] Fix cluster mapping Patch from Martin Hosken. I expect this to fix the following bugs: https://bugs.freedesktop.org/show_bug.cgi?id=75076 https://bugzilla.gnome.org/show_bug.cgi?id=723582 https://bugzilla.redhat.com/show_bug.cgi?id=998812
Konstantin Ritt 24e6b11f 2014-01-28T18:16:01 Fix double destruction in case of OOM
Behdad Esfahbod 2a8c49ad 2013-12-11T20:22:28 Remove unnecessary includes
Behdad Esfahbod 68c372ed 2013-11-13T14:44:01 More scratch-buffer cleanup
Behdad Esfahbod 16f175cb 2013-11-12T17:22:49 Fix scratch-buffer alignment warnings
Behdad Esfahbod 882edce4 2013-09-13T20:36:43 [graphite2] Fix include
Behdad Esfahbod 7148dc1a 2013-04-02T14:08:53 [graphite2] Don't crash if language is not set https://bugs.webkit.org/show_bug.cgi?id=113796
Behdad Esfahbod 8e58459a 2012-12-09T18:45:47 [graphite2] "Update to new API" Part of patch from Martin Hosken. I believe he knows what he's doing :).
Behdad Esfahbod a5a4ab38 2012-12-09T18:44:41 [graphite2] Add hb_graphite2_face_get_gr_face and hb_graphite2_font_get_gr_font Based on patch from Martin Hosken. I believe it returns NULL if the font doesn't have graphite tables, but have not tested.
Behdad Esfahbod 737ba156 2012-12-09T18:43:03 [graphite2] Preload all tables Part of patch from Martin Hosken.
Behdad Esfahbod 56e878ab 2012-08-24T00:41:51 [graphite2] Cleanup scratch buffer allocation
Behdad Esfahbod 45c1383c 2012-08-14T09:33:18 Minor
Behdad Esfahbod 4c8ac4f4 2012-08-08T17:44:19 Misc minor fixes
Behdad Esfahbod 32d71dc1 2012-08-07T14:11:16 [Graphite] Minor
Behdad Esfahbod ade7459e 2012-08-06T19:42:47 [util] Fix leaks
Behdad Esfahbod 2fef9934 2012-08-06T19:35:04 [Graphite] Fix graphite2 backend with RTL text Patch from Martin Hosken.
Behdad Esfahbod e4992e13 2012-08-06T19:25:39 [Graphite] Port graphite2 backend to new shaper infrastructure
Behdad Esfahbod 8fbfda92 2012-08-01T19:03:46 Inline font getters
Behdad Esfahbod 0594a244 2012-06-05T20:35:40 Cleanup TRUE/FALSE vs true/false
Behdad Esfahbod 8e3715f8 2012-04-23T22:18:54 Minor
Behdad Esfahbod 3cde2366 2012-04-17T11:44:49 Minor note re Graphite
Behdad Esfahbod 4dc2449d 2012-04-17T11:39:48 Fix leak in graphite
Behdad Esfahbod 6bd9b479 2012-04-12T14:53:53 Hide backend-specific shape functions Also remove shaper_options argument to hb_shape_full(). That was unused and for "future". Let it go. More shaper API coming in preparation for plan/planned API.
Behdad Esfahbod f83f0f48 2011-09-19T18:51:48 [graphite] Add note about graphite shaker brokenness
Behdad Esfahbod ea02cbf0 2011-09-02T12:39:20 [graphite] Don't preload glyphs Doesn't seem to be slower.
Behdad Esfahbod 4a8d2e37 2011-08-26T09:40:54 [graphite2] Chop a few more lines
Behdad Esfahbod 81ec289d 2011-08-26T09:33:06 Minor
Behdad Esfahbod 3380de5a 2011-08-26T09:30:49 [graphite] Use buffer->replace_glyphs()
Behdad Esfahbod a5edb103 2011-08-26T09:27:13 Minor
Behdad Esfahbod 290e3ee5 2011-08-26T09:25:04 [graphite] Only pass the first part language tag to graphite Still not sure about: 1) Case. We pass lowercase for now. Would be nice if graphite was uppercase 3letter like OpenType, 2) Padding. IMO, tag padding is always with spaces, but Martin was talking about NUL bytes.
Behdad Esfahbod 4c9fe88d 2011-08-26T09:18:53 [API] Make all _from_string() functions take a len parameter Can be -1 for NUL-terminated string. This is useful for passing parts of a larger string to a function without having to copy or modify the string first. Affected functions: hb_tag_t hb_tag_from_string() hb_direction_from_string() hb_language_from_string() hb_script_from_string()
Behdad Esfahbod a499bdea 2011-08-25T22:46:21 [graphite2] Bail if grface is NULL
Behdad Esfahbod a3bd8a0e 2011-08-24T03:22:49 [graphite] Rewrite properly
Behdad Esfahbod cd2b9010 2011-08-24T01:47:25 [graphite] Minor