├── .github ├── pull_request_template.md └── workflows │ └── ci.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── README.md ├── THANKS ├── build.zig ├── build.zig.zon ├── include └── harfbuzz │ ├── OT │ ├── Color │ │ ├── CBDT │ │ │ └── CBDT.hh │ │ ├── COLR │ │ │ ├── COLR.hh │ │ │ └── colrv1-closure.hh │ │ ├── CPAL │ │ │ └── CPAL.hh │ │ ├── sbix │ │ │ └── sbix.hh │ │ └── svg │ │ │ └── svg.hh │ ├── Layout │ │ ├── Common │ │ │ ├── Coverage.hh │ │ │ ├── CoverageFormat1.hh │ │ │ ├── CoverageFormat2.hh │ │ │ └── RangeRecord.hh │ │ ├── GDEF │ │ │ └── GDEF.hh │ │ ├── GPOS │ │ │ ├── Anchor.hh │ │ │ ├── AnchorFormat1.hh │ │ │ ├── AnchorFormat2.hh │ │ │ ├── AnchorFormat3.hh │ │ │ ├── AnchorMatrix.hh │ │ │ ├── ChainContextPos.hh │ │ │ ├── Common.hh │ │ │ ├── ContextPos.hh │ │ │ ├── CursivePos.hh │ │ │ ├── CursivePosFormat1.hh │ │ │ ├── ExtensionPos.hh │ │ │ ├── GPOS.hh │ │ │ ├── LigatureArray.hh │ │ │ ├── MarkArray.hh │ │ │ ├── MarkBasePos.hh │ │ │ ├── MarkBasePosFormat1.hh │ │ │ ├── MarkLigPos.hh │ │ │ ├── MarkLigPosFormat1.hh │ │ │ ├── MarkMarkPos.hh │ │ │ ├── MarkMarkPosFormat1.hh │ │ │ ├── MarkRecord.hh │ │ │ ├── PairPos.hh │ │ │ ├── PairPosFormat1.hh │ │ │ ├── PairPosFormat2.hh │ │ │ ├── PairSet.hh │ │ │ ├── PairValueRecord.hh │ │ │ ├── PosLookup.hh │ │ │ ├── PosLookupSubTable.hh │ │ │ ├── SinglePos.hh │ │ │ ├── SinglePosFormat1.hh │ │ │ ├── SinglePosFormat2.hh │ │ │ └── ValueFormat.hh │ │ ├── GSUB │ │ │ ├── AlternateSet.hh │ │ │ ├── AlternateSubst.hh │ │ │ ├── AlternateSubstFormat1.hh │ │ │ ├── ChainContextSubst.hh │ │ │ ├── Common.hh │ │ │ ├── ContextSubst.hh │ │ │ ├── ExtensionSubst.hh │ │ │ ├── GSUB.hh │ │ │ ├── Ligature.hh │ │ │ ├── LigatureSet.hh │ │ │ ├── LigatureSubst.hh │ │ │ ├── LigatureSubstFormat1.hh │ │ │ ├── MultipleSubst.hh │ │ │ ├── MultipleSubstFormat1.hh │ │ │ ├── ReverseChainSingleSubst.hh │ │ │ ├── ReverseChainSingleSubstFormat1.hh │ │ │ ├── Sequence.hh │ │ │ ├── SingleSubst.hh │ │ │ ├── SingleSubstFormat1.hh │ │ │ ├── SingleSubstFormat2.hh │ │ │ ├── SubstLookup.hh │ │ │ └── SubstLookupSubTable.hh │ │ └── types.hh │ ├── glyf │ │ ├── CompositeGlyph.hh │ │ ├── Glyph.hh │ │ ├── GlyphHeader.hh │ │ ├── SimpleGlyph.hh │ │ ├── SubsetGlyph.hh │ │ ├── VarCompositeGlyph.hh │ │ ├── composite-iter.hh │ │ ├── coord-setter.hh │ │ ├── glyf-helpers.hh │ │ ├── glyf.hh │ │ ├── loca.hh │ │ └── path-builder.hh │ └── name │ │ └── name.hh │ ├── addTable.py │ ├── failing-alloc.c │ ├── graph │ ├── classdef-graph.hh │ ├── coverage-graph.hh │ ├── graph.hh │ ├── gsubgpos-context.cc │ ├── gsubgpos-context.hh │ ├── gsubgpos-graph.hh │ ├── markbasepos-graph.hh │ ├── pairpos-graph.hh │ ├── serialize.hh │ ├── split-helpers.hh │ └── test-classdef-graph.cc │ ├── hb-aat-layout-ankr-table.hh │ ├── hb-aat-layout-bsln-table.hh │ ├── hb-aat-layout-common.hh │ ├── hb-aat-layout-feat-table.hh │ ├── hb-aat-layout-just-table.hh │ ├── hb-aat-layout-kerx-table.hh │ ├── hb-aat-layout-morx-table.hh │ ├── hb-aat-layout-opbd-table.hh │ ├── hb-aat-layout-trak-table.hh │ ├── hb-aat-layout.h │ ├── hb-aat-layout.hh │ ├── hb-aat-ltag-table.hh │ ├── hb-aat-map.hh │ ├── hb-aat.h │ ├── hb-algs.hh │ ├── hb-array.hh │ ├── hb-atomic.hh │ ├── hb-bimap.hh │ ├── hb-bit-page.hh │ ├── hb-bit-set-invertible.hh │ ├── hb-bit-set.hh │ ├── hb-blob.h │ ├── hb-blob.hh │ ├── hb-buffer-deserialize-json.hh │ ├── hb-buffer-deserialize-text-glyphs.hh │ ├── hb-buffer-deserialize-text-unicode.hh │ ├── hb-buffer.h │ ├── hb-buffer.hh │ ├── hb-cache.hh │ ├── hb-cairo-utils.hh │ ├── hb-cairo.h │ ├── hb-cff-interp-common.hh │ ├── hb-cff-interp-cs-common.hh │ ├── hb-cff-interp-dict-common.hh │ ├── hb-cff1-interp-cs.hh │ ├── hb-cff2-interp-cs.hh │ ├── hb-common.h │ ├── hb-config.hh │ ├── hb-coretext.h │ ├── hb-cplusplus.hh │ ├── hb-debug.hh │ ├── hb-deprecated.h │ ├── hb-directwrite.h │ ├── hb-dispatch.hh │ ├── hb-draw.h │ ├── hb-draw.hh │ ├── hb-face.h │ ├── hb-face.hh │ ├── hb-font.h │ ├── hb-font.hh │ ├── hb-ft-colr.hh │ ├── hb-ft.h │ ├── hb-gdi.h │ ├── hb-glib.h │ ├── hb-gobject-structs.h │ ├── hb-gobject.h │ ├── hb-graphite2.h │ ├── hb-icu.h │ ├── hb-iter.hh │ ├── hb-kern.hh │ ├── hb-limits.hh │ ├── hb-machinery.hh │ ├── hb-map.h │ ├── hb-map.hh │ ├── hb-meta.hh │ ├── hb-ms-feature-ranges.hh │ ├── hb-multimap.hh │ ├── hb-mutex.hh │ ├── hb-null.hh │ ├── hb-number-parser.hh │ ├── hb-number.hh │ ├── hb-object.hh │ ├── hb-open-file.hh │ ├── hb-open-type.hh │ ├── hb-ot-cff-common.hh │ ├── hb-ot-cff1-std-str.hh │ ├── hb-ot-cff1-table.hh │ ├── hb-ot-cff2-table.hh │ ├── hb-ot-cmap-table.hh │ ├── hb-ot-color.h │ ├── hb-ot-deprecated.h │ ├── hb-ot-face-table-list.hh │ ├── hb-ot-face.hh │ ├── hb-ot-font.h │ ├── hb-ot-gasp-table.hh │ ├── hb-ot-glyf-table.hh │ ├── hb-ot-hdmx-table.hh │ ├── hb-ot-head-table.hh │ ├── hb-ot-hhea-table.hh │ ├── hb-ot-hmtx-table.hh │ ├── hb-ot-kern-table.hh │ ├── hb-ot-layout-base-table.hh │ ├── hb-ot-layout-common.hh │ ├── hb-ot-layout-gdef-table.hh │ ├── hb-ot-layout-gpos-table.hh │ ├── hb-ot-layout-gsub-table.hh │ ├── hb-ot-layout-gsubgpos.hh │ ├── hb-ot-layout-jstf-table.hh │ ├── hb-ot-layout.h │ ├── hb-ot-layout.hh │ ├── hb-ot-map.hh │ ├── hb-ot-math-table.hh │ ├── hb-ot-math.h │ ├── hb-ot-maxp-table.hh │ ├── hb-ot-meta-table.hh │ ├── hb-ot-meta.h │ ├── hb-ot-metrics.h │ ├── hb-ot-metrics.hh │ ├── hb-ot-name-language-static.hh │ ├── hb-ot-name-language.hh │ ├── hb-ot-name-table.hh │ ├── hb-ot-name.h │ ├── hb-ot-os2-table.hh │ ├── hb-ot-os2-unicode-ranges.hh │ ├── hb-ot-post-macroman.hh │ ├── hb-ot-post-table-v2subset.hh │ ├── hb-ot-post-table.hh │ ├── hb-ot-shape-fallback.hh │ ├── hb-ot-shape-normalize.hh │ ├── hb-ot-shape.h │ ├── hb-ot-shape.hh │ ├── hb-ot-shaper-arabic-fallback.hh │ ├── hb-ot-shaper-arabic-joining-list.hh │ ├── hb-ot-shaper-arabic-pua.hh │ ├── hb-ot-shaper-arabic-table.hh │ ├── hb-ot-shaper-arabic-win1256.hh │ ├── hb-ot-shaper-arabic.hh │ ├── hb-ot-shaper-indic-machine.hh │ ├── hb-ot-shaper-indic.hh │ ├── hb-ot-shaper-khmer-machine.hh │ ├── hb-ot-shaper-myanmar-machine.hh │ ├── hb-ot-shaper-syllabic.hh │ ├── hb-ot-shaper-use-machine.hh │ ├── hb-ot-shaper-use-table.hh │ ├── hb-ot-shaper-vowel-constraints.hh │ ├── hb-ot-shaper.hh │ ├── hb-ot-stat-table.hh │ ├── hb-ot-tag-table.hh │ ├── hb-ot-var-avar-table.hh │ ├── hb-ot-var-common.hh │ ├── hb-ot-var-cvar-table.hh │ ├── hb-ot-var-fvar-table.hh │ ├── hb-ot-var-gvar-table.hh │ ├── hb-ot-var-hvar-table.hh │ ├── hb-ot-var-mvar-table.hh │ ├── hb-ot-var.h │ ├── hb-ot-vorg-table.hh │ ├── hb-ot.h │ ├── hb-outline.hh │ ├── hb-paint-extents.hh │ ├── hb-paint.h │ ├── hb-paint.hh │ ├── hb-pool.hh │ ├── hb-priority-queue.hh │ ├── hb-repacker.hh │ ├── hb-sanitize.hh │ ├── hb-serialize.hh │ ├── hb-set-digest.hh │ ├── hb-set.h │ ├── hb-set.hh │ ├── hb-shape-plan.h │ ├── hb-shape-plan.hh │ ├── hb-shape.h │ ├── hb-shaper-impl.hh │ ├── hb-shaper-list.hh │ ├── hb-shaper.hh │ ├── hb-string-array.hh │ ├── hb-style.h │ ├── hb-subset-accelerator.hh │ ├── hb-subset-cff-common.hh │ ├── hb-subset-input.hh │ ├── hb-subset-instancer-solver.hh │ ├── hb-subset-plan-member-list.hh │ ├── hb-subset-plan.hh │ ├── hb-subset-repacker.h │ ├── hb-subset.h │ ├── hb-subset.hh │ ├── hb-ucd-table.hh │ ├── hb-unicode-emoji-table.hh │ ├── hb-unicode.h │ ├── hb-unicode.hh │ ├── hb-uniscribe.h │ ├── hb-utf.hh │ ├── hb-vector.hh │ ├── hb-version.h │ ├── hb-wasm-api-blob.hh │ ├── hb-wasm-api-buffer.hh │ ├── hb-wasm-api-common.hh │ ├── hb-wasm-api-face.hh │ ├── hb-wasm-api-font.hh │ ├── hb-wasm-api-list.hh │ ├── hb-wasm-api-shape.hh │ ├── hb-wasm-api.h │ ├── hb-wasm-api.hh │ ├── hb.h │ └── hb.hh ├── src ├── OT │ ├── Color │ │ ├── CBDT │ │ │ └── CBDT.hh │ │ ├── COLR │ │ │ ├── COLR.hh │ │ │ └── colrv1-closure.hh │ │ ├── CPAL │ │ │ └── CPAL.hh │ │ ├── sbix │ │ │ └── sbix.hh │ │ └── svg │ │ │ └── svg.hh │ ├── Layout │ │ ├── Common │ │ │ ├── Coverage.hh │ │ │ ├── CoverageFormat1.hh │ │ │ ├── CoverageFormat2.hh │ │ │ └── RangeRecord.hh │ │ ├── GDEF │ │ │ └── GDEF.hh │ │ ├── GPOS │ │ │ ├── Anchor.hh │ │ │ ├── AnchorFormat1.hh │ │ │ ├── AnchorFormat2.hh │ │ │ ├── AnchorFormat3.hh │ │ │ ├── AnchorMatrix.hh │ │ │ ├── ChainContextPos.hh │ │ │ ├── Common.hh │ │ │ ├── ContextPos.hh │ │ │ ├── CursivePos.hh │ │ │ ├── CursivePosFormat1.hh │ │ │ ├── ExtensionPos.hh │ │ │ ├── GPOS.hh │ │ │ ├── LigatureArray.hh │ │ │ ├── MarkArray.hh │ │ │ ├── MarkBasePos.hh │ │ │ ├── MarkBasePosFormat1.hh │ │ │ ├── MarkLigPos.hh │ │ │ ├── MarkLigPosFormat1.hh │ │ │ ├── MarkMarkPos.hh │ │ │ ├── MarkMarkPosFormat1.hh │ │ │ ├── MarkRecord.hh │ │ │ ├── PairPos.hh │ │ │ ├── PairPosFormat1.hh │ │ │ ├── PairPosFormat2.hh │ │ │ ├── PairSet.hh │ │ │ ├── PairValueRecord.hh │ │ │ ├── PosLookup.hh │ │ │ ├── PosLookupSubTable.hh │ │ │ ├── SinglePos.hh │ │ │ ├── SinglePosFormat1.hh │ │ │ ├── SinglePosFormat2.hh │ │ │ └── ValueFormat.hh │ │ ├── GSUB │ │ │ ├── AlternateSet.hh │ │ │ ├── AlternateSubst.hh │ │ │ ├── AlternateSubstFormat1.hh │ │ │ ├── ChainContextSubst.hh │ │ │ ├── Common.hh │ │ │ ├── ContextSubst.hh │ │ │ ├── ExtensionSubst.hh │ │ │ ├── GSUB.hh │ │ │ ├── Ligature.hh │ │ │ ├── LigatureSet.hh │ │ │ ├── LigatureSubst.hh │ │ │ ├── LigatureSubstFormat1.hh │ │ │ ├── MultipleSubst.hh │ │ │ ├── MultipleSubstFormat1.hh │ │ │ ├── ReverseChainSingleSubst.hh │ │ │ ├── ReverseChainSingleSubstFormat1.hh │ │ │ ├── Sequence.hh │ │ │ ├── SingleSubst.hh │ │ │ ├── SingleSubstFormat1.hh │ │ │ ├── SingleSubstFormat2.hh │ │ │ ├── SubstLookup.hh │ │ │ └── SubstLookupSubTable.hh │ │ └── types.hh │ ├── glyf │ │ ├── CompositeGlyph.hh │ │ ├── Glyph.hh │ │ ├── GlyphHeader.hh │ │ ├── SimpleGlyph.hh │ │ ├── SubsetGlyph.hh │ │ ├── VarCompositeGlyph.hh │ │ ├── composite-iter.hh │ │ ├── coord-setter.hh │ │ ├── glyf-helpers.hh │ │ ├── glyf.hh │ │ ├── loca.hh │ │ └── path-builder.hh │ └── name │ │ └── name.hh ├── addTable.py ├── failing-alloc.c ├── graph │ ├── classdef-graph.hh │ ├── coverage-graph.hh │ ├── graph.hh │ ├── gsubgpos-context.cc │ ├── gsubgpos-context.hh │ ├── gsubgpos-graph.hh │ ├── markbasepos-graph.hh │ ├── pairpos-graph.hh │ ├── serialize.hh │ ├── split-helpers.hh │ └── test-classdef-graph.cc ├── harfbuzz-subset.cc ├── harfbuzz.cc ├── hb-aat-layout-ankr-table.hh ├── hb-aat-layout-bsln-table.hh ├── hb-aat-layout-common.hh ├── hb-aat-layout-feat-table.hh ├── hb-aat-layout-just-table.hh ├── hb-aat-layout-kerx-table.hh ├── hb-aat-layout-morx-table.hh ├── hb-aat-layout-opbd-table.hh ├── hb-aat-layout-trak-table.hh ├── hb-aat-layout.cc ├── hb-aat-layout.h ├── hb-aat-layout.hh ├── hb-aat-ltag-table.hh ├── hb-aat-map.cc ├── hb-aat-map.hh ├── hb-aat.h ├── hb-algs.hh ├── hb-array.hh ├── hb-atomic.hh ├── hb-bimap.hh ├── hb-bit-page.hh ├── hb-bit-set-invertible.hh ├── hb-bit-set.hh ├── hb-blob.cc ├── hb-blob.h ├── hb-blob.hh ├── hb-buffer-deserialize-json.hh ├── hb-buffer-deserialize-text-glyphs.hh ├── hb-buffer-deserialize-text-unicode.hh ├── hb-buffer-serialize.cc ├── hb-buffer-verify.cc ├── hb-buffer.cc ├── hb-buffer.h ├── hb-buffer.hh ├── hb-cache.hh ├── hb-cairo-utils.cc ├── hb-cairo-utils.hh ├── hb-cairo.cc ├── hb-cairo.h ├── hb-cff-interp-common.hh ├── hb-cff-interp-cs-common.hh ├── hb-cff-interp-dict-common.hh ├── hb-cff1-interp-cs.hh ├── hb-cff2-interp-cs.hh ├── hb-common.cc ├── hb-common.h ├── hb-config.hh ├── hb-coretext.cc ├── hb-coretext.h ├── hb-cplusplus.hh ├── hb-debug.hh ├── hb-deprecated.h ├── hb-directwrite.cc ├── hb-directwrite.h ├── hb-dispatch.hh ├── hb-draw.cc ├── hb-draw.h ├── hb-draw.hh ├── hb-face-builder.cc ├── hb-face.cc ├── hb-face.h ├── hb-face.hh ├── hb-fallback-shape.cc ├── hb-font.cc ├── hb-font.h ├── hb-font.hh ├── hb-ft-colr.hh ├── hb-ft.cc ├── hb-ft.h ├── hb-gdi.cc ├── hb-gdi.h ├── hb-glib.cc ├── hb-glib.h ├── hb-gobject-structs.cc ├── hb-gobject-structs.h ├── hb-gobject.h ├── hb-graphite2.cc ├── hb-graphite2.h ├── hb-icu.cc ├── hb-icu.h ├── hb-iter.hh ├── hb-kern.hh ├── hb-limits.hh ├── hb-machinery.hh ├── hb-map.cc ├── hb-map.h ├── hb-map.hh ├── hb-meta.hh ├── hb-ms-feature-ranges.hh ├── hb-multimap.hh ├── hb-mutex.hh ├── hb-null.hh ├── hb-number-parser.hh ├── hb-number.cc ├── hb-number.hh ├── hb-object.hh ├── hb-open-file.hh ├── hb-open-type.hh ├── hb-ot-cff-common.hh ├── hb-ot-cff1-std-str.hh ├── hb-ot-cff1-table.cc ├── hb-ot-cff1-table.hh ├── hb-ot-cff2-table.cc ├── hb-ot-cff2-table.hh ├── hb-ot-cmap-table.hh ├── hb-ot-color.cc ├── hb-ot-color.h ├── hb-ot-deprecated.h ├── hb-ot-face-table-list.hh ├── hb-ot-face.cc ├── hb-ot-face.hh ├── hb-ot-font.cc ├── hb-ot-font.h ├── hb-ot-gasp-table.hh ├── hb-ot-glyf-table.hh ├── hb-ot-hdmx-table.hh ├── hb-ot-head-table.hh ├── hb-ot-hhea-table.hh ├── hb-ot-hmtx-table.hh ├── hb-ot-kern-table.hh ├── hb-ot-layout-base-table.hh ├── hb-ot-layout-common.hh ├── hb-ot-layout-gdef-table.hh ├── hb-ot-layout-gpos-table.hh ├── hb-ot-layout-gsub-table.hh ├── hb-ot-layout-gsubgpos.hh ├── hb-ot-layout-jstf-table.hh ├── hb-ot-layout.cc ├── hb-ot-layout.h ├── hb-ot-layout.hh ├── hb-ot-map.cc ├── hb-ot-map.hh ├── hb-ot-math-table.hh ├── hb-ot-math.cc ├── hb-ot-math.h ├── hb-ot-maxp-table.hh ├── hb-ot-meta-table.hh ├── hb-ot-meta.cc ├── hb-ot-meta.h ├── hb-ot-metrics.cc ├── hb-ot-metrics.h ├── hb-ot-metrics.hh ├── hb-ot-name-language-static.hh ├── hb-ot-name-language.hh ├── hb-ot-name-table.hh ├── hb-ot-name.cc ├── hb-ot-name.h ├── hb-ot-os2-table.hh ├── hb-ot-os2-unicode-ranges.hh ├── hb-ot-post-macroman.hh ├── hb-ot-post-table-v2subset.hh ├── hb-ot-post-table.hh ├── hb-ot-shape-fallback.cc ├── hb-ot-shape-fallback.hh ├── hb-ot-shape-normalize.cc ├── hb-ot-shape-normalize.hh ├── hb-ot-shape.cc ├── hb-ot-shape.h ├── hb-ot-shape.hh ├── hb-ot-shaper-arabic-fallback.hh ├── hb-ot-shaper-arabic-joining-list.hh ├── hb-ot-shaper-arabic-pua.hh ├── hb-ot-shaper-arabic-table.hh ├── hb-ot-shaper-arabic-win1256.hh ├── hb-ot-shaper-arabic.cc ├── hb-ot-shaper-arabic.hh ├── hb-ot-shaper-default.cc ├── hb-ot-shaper-hangul.cc ├── hb-ot-shaper-hebrew.cc ├── hb-ot-shaper-indic-machine.hh ├── hb-ot-shaper-indic-table.cc ├── hb-ot-shaper-indic.cc ├── hb-ot-shaper-indic.hh ├── hb-ot-shaper-khmer-machine.hh ├── hb-ot-shaper-khmer.cc ├── hb-ot-shaper-myanmar-machine.hh ├── hb-ot-shaper-myanmar.cc ├── hb-ot-shaper-syllabic.cc ├── hb-ot-shaper-syllabic.hh ├── hb-ot-shaper-thai.cc ├── hb-ot-shaper-use-machine.hh ├── hb-ot-shaper-use-table.hh ├── hb-ot-shaper-use.cc ├── hb-ot-shaper-vowel-constraints.cc ├── hb-ot-shaper-vowel-constraints.hh ├── hb-ot-shaper.hh ├── hb-ot-stat-table.hh ├── hb-ot-tag-table.hh ├── hb-ot-tag.cc ├── hb-ot-var-avar-table.hh ├── hb-ot-var-common.hh ├── hb-ot-var-cvar-table.hh ├── hb-ot-var-fvar-table.hh ├── hb-ot-var-gvar-table.hh ├── hb-ot-var-hvar-table.hh ├── hb-ot-var-mvar-table.hh ├── hb-ot-var.cc ├── hb-ot-var.h ├── hb-ot-vorg-table.hh ├── hb-ot.h ├── hb-outline.cc ├── hb-outline.hh ├── hb-paint-extents.cc ├── hb-paint-extents.hh ├── hb-paint.cc ├── hb-paint.h ├── hb-paint.hh ├── hb-pool.hh ├── hb-priority-queue.hh ├── hb-repacker.hh ├── hb-sanitize.hh ├── hb-serialize.hh ├── hb-set-digest.hh ├── hb-set.cc ├── hb-set.h ├── hb-set.hh ├── hb-shape-plan.cc ├── hb-shape-plan.h ├── hb-shape-plan.hh ├── hb-shape.cc ├── hb-shape.h ├── hb-shaper-impl.hh ├── hb-shaper-list.hh ├── hb-shaper.cc ├── hb-shaper.hh ├── hb-static.cc ├── hb-string-array.hh ├── hb-style.cc ├── hb-style.h ├── hb-subset-accelerator.hh ├── hb-subset-cff-common.cc ├── hb-subset-cff-common.hh ├── hb-subset-cff1.cc ├── hb-subset-cff2.cc ├── hb-subset-input.cc ├── hb-subset-input.hh ├── hb-subset-instancer-solver.cc ├── hb-subset-instancer-solver.hh ├── hb-subset-plan-member-list.hh ├── hb-subset-plan.cc ├── hb-subset-plan.hh ├── hb-subset-repacker.cc ├── hb-subset-repacker.h ├── hb-subset.cc ├── hb-subset.h ├── hb-subset.hh ├── hb-ucd-table.hh ├── hb-ucd.cc ├── hb-unicode-emoji-table.hh ├── hb-unicode.cc ├── hb-unicode.h ├── hb-unicode.hh ├── hb-uniscribe.cc ├── hb-uniscribe.h ├── hb-utf.hh ├── hb-vector.hh ├── hb-version.h ├── hb-wasm-api-blob.hh ├── hb-wasm-api-buffer.hh ├── hb-wasm-api-common.hh ├── hb-wasm-api-face.hh ├── hb-wasm-api-font.hh ├── hb-wasm-api-list.hh ├── hb-wasm-api-shape.hh ├── hb-wasm-api.cc ├── hb-wasm-api.h ├── hb-wasm-api.hh ├── hb-wasm-shape.cc ├── hb.h ├── hb.hh ├── main.cc ├── test-algs.cc ├── test-array.cc ├── test-bimap.cc ├── test-buffer-serialize.cc ├── test-gpos-size-params.cc ├── test-gsub-get-alternates.cc ├── test-gsub-would-substitute.cc ├── test-iter.cc ├── test-machinery.cc ├── test-map.cc ├── test-multimap.cc ├── test-number.cc ├── test-ot-glyphname.cc ├── test-ot-meta.cc ├── test-ot-name.cc ├── test-priority-queue.cc ├── test-repacker.cc ├── test-serialize.cc ├── test-set.cc ├── test-subset-instancer-solver.cc ├── test-tuple-varstore.cc ├── test-unicode-ranges.cc ├── test-use-table.cc ├── test-vector.cc ├── test.cc └── wasm │ ├── graphite │ └── shape.cc │ ├── rust │ └── harfbuzz-wasm │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs │ └── sample │ ├── c │ ├── shape-fallback.cc │ ├── shape-ot.cc │ └── test.ttf │ └── rust │ └── hello-wasm │ ├── Cargo.toml │ └── src │ └── lib.rs ├── update.sh └── verify.sh /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | - [ ] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right. -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | - push 4 | - pull_request 5 | jobs: 6 | x86_64-linux: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v2 11 | with: 12 | submodules: 'true' 13 | - name: Setup Zig 14 | run: | 15 | sudo apt install xz-utils 16 | sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-linux-x86_64-0.14.0-dev.2577+271452d22.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' 17 | - name: build 18 | run: zig build 19 | x86_64-windows: 20 | runs-on: windows-latest 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v2 24 | with: 25 | submodules: 'true' 26 | - name: Setup Zig 27 | run: | 28 | $ProgressPreference = 'SilentlyContinue' 29 | Invoke-WebRequest -Uri "https://pkg.machengine.org/zig/zig-windows-x86_64-0.14.0-dev.2577+271452d22.zip" -OutFile "C:\zig.zip" 30 | cd C:\ 31 | 7z x zig.zip 32 | Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.14.0-dev.2577+271452d22\" 33 | - name: build 34 | run: zig build 35 | x86_64-macos: 36 | runs-on: macos-12 37 | steps: 38 | - name: Checkout 39 | uses: actions/checkout@v2 40 | with: 41 | submodules: 'true' 42 | - name: Setup Zig 43 | run: | 44 | brew install xz 45 | sudo sh -c 'wget -c https://pkg.machengine.org/zig/zig-macos-x86_64-0.14.0-dev.2577+271452d22.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' 46 | - name: build 47 | run: zig build 48 | env: 49 | AGREE: true 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | zig-* 2 | .zig-cache -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Behdad Esfahbod 2 | David Corbett 3 | David Turner 4 | Ebrahim Byagowi 5 | Garret Rieger 6 | Jonathan Kew 7 | Khaled Hosny 8 | Lars Knoll 9 | Martin Hosken 10 | Owen Taylor 11 | Roderick Sheeter 12 | Roozbeh Pournader 13 | Simon Hausmann 14 | Werner Lemberg 15 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. 2 | For parts of HarfBuzz that are licensed under different licenses see individual 3 | files names COPYING in subdirectories where applicable. 4 | 5 | Copyright © 2010-2022 Google, Inc. 6 | Copyright © 2015-2020 Ebrahim Byagowi 7 | Copyright © 2019,2020 Facebook, Inc. 8 | Copyright © 2012,2015 Mozilla Foundation 9 | Copyright © 2011 Codethink Limited 10 | Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) 11 | Copyright © 2009 Keith Stribley 12 | Copyright © 2011 Martin Hosken and SIL International 13 | Copyright © 2007 Chris Wilson 14 | Copyright © 2005,2006,2020,2021,2022,2023 Behdad Esfahbod 15 | Copyright © 2004,2007,2008,2009,2010,2013,2021,2022,2023 Red Hat, Inc. 16 | Copyright © 1998-2005 David Turner and Werner Lemberg 17 | Copyright © 2016 Igalia S.L. 18 | Copyright © 2022 Matthias Clasen 19 | Copyright © 2018,2021 Khaled Hosny 20 | Copyright © 2018,2019,2020 Adobe, Inc 21 | Copyright © 2013-2015 Alexei Podtelezhnikov 22 | 23 | For full copyright notices consult the individual files in the package. 24 | 25 | 26 | Permission is hereby granted, without written agreement and without 27 | license or royalty fees, to use, copy, modify, and distribute this 28 | software and its documentation for any purpose, provided that the 29 | above copyright notice and the following two paragraphs appear in 30 | all copies of this software. 31 | 32 | IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 33 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 34 | ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 35 | IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 36 | DAMAGE. 37 | 38 | THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 39 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 40 | FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 41 | ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 42 | PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # harfbuzz packaged for the Zig build system 2 | 3 | This is a fork of [harfbuzz](https://github.com/harfbuzz/harfbuzz), packaged for Zig. Unnecessary files have been deleted, and the build system has been replaced with build.zig. 4 | 5 | ## Updating 6 | 7 | To update this repository, run `./update.sh` followed by `./verify.sh` to verify the repository contents. 8 | 9 | ## Verifying repository contents 10 | 11 | For supply chain security reasons (e.g. to confirm we made no patches to the code) we provide a `git diff` command you can run to verify the contents of this repository: 12 | 13 | ```sh 14 | ./verify.sh 15 | ``` 16 | 17 | If nothing is printed, there is no diff. Deleted files, and changes to `README.md`, `build.zig`, `.github` CI files and `.gitignore` are ignored. 18 | 19 | ## Issues 20 | 21 | Issues are tracked in the [main Mach repository](https://github.com/hexops/mach/issues?q=is%3Aissue+is%3Aopen+label%3Aharfbuzz). 22 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | Bradley Grainger 2 | Kenichi Ishibashi 3 | Ivan Kuckir 4 | Ryan Lortie 5 | Jeff Muizelaar 6 | suzuki toshiya 7 | Philip Withnall 8 | -------------------------------------------------------------------------------- /build.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | pub fn build(b: *std.Build) void { 4 | const target = b.standardTargetOptions(.{}); 5 | const optimize = b.standardOptimizeOption(.{}); 6 | const enable_freetype = b.option(bool, "enable_freetype", "Build Freetype") orelse true; 7 | const use_system_zlib = b.option(bool, "freetype_use_system_zlib", "Use system zlib") orelse false; 8 | const enable_brotli = b.option(bool, "freetype_enable_brotli", "Build brotli") orelse true; 9 | 10 | const lib = b.addStaticLibrary(.{ 11 | .name = "harfbuzz", 12 | .target = target, 13 | .optimize = optimize, 14 | }); 15 | lib.addCSourceFile(.{ .file = b.path("src/harfbuzz.cc") }); 16 | lib.linkLibCpp(); 17 | lib.installHeadersDirectory(b.path("src"), "harfbuzz", .{ 18 | .exclude_extensions = &.{".cc"}, 19 | }); 20 | if (enable_freetype) { 21 | lib.root_module.addCMacro("HAVE_FREETYPE", "1"); 22 | 23 | if (b.lazyDependency("freetype", .{ 24 | .target = target, 25 | .optimize = optimize, 26 | .use_system_zlib = use_system_zlib, 27 | .enable_brotli = enable_brotli, 28 | })) |dep| { 29 | lib.linkLibrary(dep.artifact("freetype")); 30 | } 31 | } 32 | b.installArtifact(lib); 33 | } 34 | -------------------------------------------------------------------------------- /build.zig.zon: -------------------------------------------------------------------------------- 1 | .{ 2 | .name = "harfbuzz", 3 | .version = "0.0.0", 4 | .paths = .{ 5 | "include", 6 | "src", 7 | "AUTHORS", 8 | "build.zig", 9 | "build.zig.zon", 10 | "COPYING", 11 | "README.md", 12 | "THANKS", 13 | "update.sh", 14 | "verify.sh", 15 | }, 16 | .dependencies = .{ 17 | .freetype = .{ 18 | .url = "https://pkg.machengine.org/freetype/972cd37bccecae2cc9f54cf0b562263a13209d02.tar.gz", 19 | .hash = "12204cba3a237cd2c4ab983f5a28d9b54e7a9912d8c7c6e38e23140b0171d6e1ebf8", 20 | }, 21 | .brotli = .{ 22 | .url = "https://pkg.machengine.org/brotli/10961426f03016e273f4f4653eae907e9e2339b6.tar.gz", 23 | .hash = "122031789a7c6364c2f99164c1183661bb5fe914ad7336cc224039c7fba649f35c47", 24 | .lazy = true, 25 | }, 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/AnchorFormat1.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_ANCHORFORMAT1_HH 2 | #define OT_LAYOUT_GPOS_ANCHORFORMAT1_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct AnchorFormat1 9 | { 10 | protected: 11 | HBUINT16 format; /* Format identifier--format = 1 */ 12 | FWORD xCoordinate; /* Horizontal value--in design units */ 13 | FWORD yCoordinate; /* Vertical value--in design units */ 14 | public: 15 | DEFINE_SIZE_STATIC (6); 16 | 17 | bool sanitize (hb_sanitize_context_t *c) const 18 | { 19 | TRACE_SANITIZE (this); 20 | return_trace (c->check_struct (this)); 21 | } 22 | 23 | void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, 24 | float *x, float *y) const 25 | { 26 | hb_font_t *font = c->font; 27 | *x = font->em_fscale_x (xCoordinate); 28 | *y = font->em_fscale_y (yCoordinate); 29 | } 30 | 31 | AnchorFormat1* copy (hb_serialize_context_t *c) const 32 | { 33 | TRACE_SERIALIZE (this); 34 | AnchorFormat1* out = c->embed (this); 35 | if (!out) return_trace (out); 36 | out->format = 1; 37 | return_trace (out); 38 | } 39 | }; 40 | 41 | 42 | } 43 | } 44 | } 45 | 46 | #endif // OT_LAYOUT_GPOS_ANCHORFORMAT1_HH 47 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/AnchorFormat2.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_ANCHORFORMAT2_HH 2 | #define OT_LAYOUT_GPOS_ANCHORFORMAT2_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct AnchorFormat2 9 | { 10 | 11 | protected: 12 | HBUINT16 format; /* Format identifier--format = 2 */ 13 | FWORD xCoordinate; /* Horizontal value--in design units */ 14 | FWORD yCoordinate; /* Vertical value--in design units */ 15 | HBUINT16 anchorPoint; /* Index to glyph contour point */ 16 | public: 17 | DEFINE_SIZE_STATIC (8); 18 | 19 | bool sanitize (hb_sanitize_context_t *c) const 20 | { 21 | TRACE_SANITIZE (this); 22 | return_trace (c->check_struct (this)); 23 | } 24 | 25 | void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id, 26 | float *x, float *y) const 27 | { 28 | hb_font_t *font = c->font; 29 | 30 | #ifdef HB_NO_HINTING 31 | *x = font->em_fscale_x (xCoordinate); 32 | *y = font->em_fscale_y (yCoordinate); 33 | return; 34 | #endif 35 | 36 | unsigned int x_ppem = font->x_ppem; 37 | unsigned int y_ppem = font->y_ppem; 38 | hb_position_t cx = 0, cy = 0; 39 | bool ret; 40 | 41 | ret = (x_ppem || y_ppem) && 42 | font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy); 43 | *x = ret && x_ppem ? cx : font->em_fscale_x (xCoordinate); 44 | *y = ret && y_ppem ? cy : font->em_fscale_y (yCoordinate); 45 | } 46 | 47 | AnchorFormat2* copy (hb_serialize_context_t *c) const 48 | { 49 | TRACE_SERIALIZE (this); 50 | return_trace (c->embed (this)); 51 | } 52 | }; 53 | 54 | } 55 | } 56 | } 57 | 58 | #endif // OT_LAYOUT_GPOS_ANCHORFORMAT2_HH 59 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/ChainContextPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_CHAINCONTEXTPOS_HH 2 | #define OT_LAYOUT_GPOS_CHAINCONTEXTPOS_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct ChainContextPos : ChainContext {}; 9 | 10 | } 11 | } 12 | } 13 | 14 | #endif /* OT_LAYOUT_GPOS_CHAINCONTEXTPOS_HH */ 15 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/Common.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_COMMON_HH 2 | #define OT_LAYOUT_GPOS_COMMON_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | enum attach_type_t { 9 | ATTACH_TYPE_NONE = 0X00, 10 | 11 | /* Each attachment should be either a mark or a cursive; can't be both. */ 12 | ATTACH_TYPE_MARK = 0X01, 13 | ATTACH_TYPE_CURSIVE = 0X02, 14 | }; 15 | 16 | /* buffer **position** var allocations */ 17 | #define attach_chain() var.i16[0] /* glyph to which this attaches to, relative to current glyphs; negative for going back, positive for forward. */ 18 | #define attach_type() var.u8[2] /* attachment type */ 19 | /* Note! if attach_chain() is zero, the value of attach_type() is irrelevant. */ 20 | 21 | template 22 | static void SinglePos_serialize (hb_serialize_context_t *c, 23 | const SrcLookup *src, 24 | Iterator it, 25 | const hb_hashmap_t> *layout_variation_idx_delta_map, 26 | bool all_axes_pinned); 27 | 28 | 29 | } 30 | } 31 | } 32 | 33 | #endif // OT_LAYOUT_GPOS_COMMON_HH 34 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/ContextPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_CONTEXTPOS_HH 2 | #define OT_LAYOUT_GPOS_CONTEXTPOS_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct ContextPos : Context {}; 9 | 10 | } 11 | } 12 | } 13 | 14 | #endif /* OT_LAYOUT_GPOS_CONTEXTPOS_HH */ 15 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/CursivePos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_CURSIVEPOS_HH 2 | #define OT_LAYOUT_GPOS_CURSIVEPOS_HH 3 | 4 | #include "CursivePosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct CursivePos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | CursivePosFormat1 format1; 16 | } u; 17 | 18 | public: 19 | template 20 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 21 | { 22 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 23 | TRACE_DISPATCH (this, u.format); 24 | switch (u.format) { 25 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 26 | default:return_trace (c->default_return_value ()); 27 | } 28 | } 29 | }; 30 | 31 | } 32 | } 33 | } 34 | 35 | #endif /* OT_LAYOUT_GPOS_CURSIVEPOS_HH */ 36 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/ExtensionPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_EXTENSIONPOS_HH 2 | #define OT_LAYOUT_GPOS_EXTENSIONPOS_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct ExtensionPos : Extension 9 | { 10 | typedef struct PosLookupSubTable SubTable; 11 | }; 12 | 13 | } 14 | } 15 | } 16 | 17 | #endif /* OT_LAYOUT_GPOS_EXTENSIONPOS_HH */ 18 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/LigatureArray.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_LIGATUREARRAY_HH 2 | #define OT_LAYOUT_GPOS_LIGATUREARRAY_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | 9 | typedef AnchorMatrix LigatureAttach; /* component-major-- 10 | * in order of writing direction--, 11 | * mark-minor-- 12 | * ordered by class--zero-based. */ 13 | 14 | /* Array of LigatureAttach tables ordered by LigatureCoverage Index */ 15 | struct LigatureArray : List16OfOffset16To 16 | { 17 | template 19 | bool subset (hb_subset_context_t *c, 20 | Iterator coverage, 21 | unsigned class_count, 22 | const hb_map_t *klass_mapping) const 23 | { 24 | TRACE_SUBSET (this); 25 | const hb_set_t &glyphset = *c->plan->glyphset_gsub (); 26 | 27 | auto *out = c->serializer->start_embed (this); 28 | if (unlikely (!c->serializer->extend_min (out))) return_trace (false); 29 | 30 | for (const auto _ : + hb_zip (coverage, *this) 31 | | hb_filter (glyphset, hb_first)) 32 | { 33 | auto *matrix = out->serialize_append (c->serializer); 34 | if (unlikely (!matrix)) return_trace (false); 35 | 36 | const LigatureAttach& src = (this + _.second); 37 | auto indexes = 38 | + hb_range (src.rows * class_count) 39 | | hb_filter ([=] (unsigned index) { return klass_mapping->has (index % class_count); }) 40 | ; 41 | matrix->serialize_subset (c, 42 | _.second, 43 | this, 44 | src.rows, 45 | indexes); 46 | } 47 | return_trace (this->len); 48 | } 49 | }; 50 | 51 | 52 | } 53 | } 54 | } 55 | 56 | #endif /* OT_LAYOUT_GPOS_LIGATUREARRAY_HH */ 57 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/MarkBasePos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKBASEPOS_HH 2 | #define OT_LAYOUT_GPOS_MARKBASEPOS_HH 3 | 4 | #include "MarkBasePosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct MarkBasePos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | MarkBasePosFormat1_2 format1; 16 | #ifndef HB_NO_BEYOND_64K 17 | MarkBasePosFormat1_2 format2; 18 | #endif 19 | } u; 20 | 21 | public: 22 | template 23 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 24 | { 25 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 26 | TRACE_DISPATCH (this, u.format); 27 | switch (u.format) { 28 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 29 | #ifndef HB_NO_BEYOND_64K 30 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 31 | #endif 32 | default:return_trace (c->default_return_value ()); 33 | } 34 | } 35 | }; 36 | 37 | } 38 | } 39 | } 40 | 41 | #endif /* OT_LAYOUT_GPOS_MARKBASEPOS_HH */ 42 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/MarkLigPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKLIGPOS_HH 2 | #define OT_LAYOUT_GPOS_MARKLIGPOS_HH 3 | 4 | #include "MarkLigPosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct MarkLigPos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | MarkLigPosFormat1_2 format1; 16 | #ifndef HB_NO_BEYOND_64K 17 | MarkLigPosFormat1_2 format2; 18 | #endif 19 | } u; 20 | 21 | public: 22 | template 23 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 24 | { 25 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 26 | TRACE_DISPATCH (this, u.format); 27 | switch (u.format) { 28 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 29 | #ifndef HB_NO_BEYOND_64K 30 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 31 | #endif 32 | default:return_trace (c->default_return_value ()); 33 | } 34 | } 35 | }; 36 | 37 | } 38 | } 39 | } 40 | 41 | #endif /* OT_LAYOUT_GPOS_MARKLIGPOS_HH */ 42 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/MarkMarkPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKMARKPOS_HH 2 | #define OT_LAYOUT_GPOS_MARKMARKPOS_HH 3 | 4 | #include "MarkMarkPosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct MarkMarkPos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | MarkMarkPosFormat1_2 format1; 16 | #ifndef HB_NO_BEYOND_64K 17 | MarkMarkPosFormat1_2 format2; 18 | #endif 19 | } u; 20 | 21 | public: 22 | template 23 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 24 | { 25 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 26 | TRACE_DISPATCH (this, u.format); 27 | switch (u.format) { 28 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 29 | #ifndef HB_NO_BEYOND_64K 30 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 31 | #endif 32 | default:return_trace (c->default_return_value ()); 33 | } 34 | } 35 | }; 36 | 37 | 38 | } 39 | } 40 | } 41 | 42 | #endif /* OT_LAYOUT_GPOS_MARKMARKPOS_HH */ 43 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/MarkRecord.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKRECORD_HH 2 | #define OT_LAYOUT_GPOS_MARKRECORD_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct MarkRecord 9 | { 10 | friend struct MarkArray; 11 | 12 | public: 13 | HBUINT16 klass; /* Class defined for this mark */ 14 | Offset16To 15 | markAnchor; /* Offset to Anchor table--from 16 | * beginning of MarkArray table */ 17 | public: 18 | DEFINE_SIZE_STATIC (4); 19 | 20 | unsigned get_class () const { return (unsigned) klass; } 21 | bool sanitize (hb_sanitize_context_t *c, const void *base) const 22 | { 23 | TRACE_SANITIZE (this); 24 | return_trace (c->check_struct (this) && markAnchor.sanitize (c, base)); 25 | } 26 | 27 | MarkRecord *subset (hb_subset_context_t *c, 28 | const void *src_base, 29 | const hb_map_t *klass_mapping) const 30 | { 31 | TRACE_SUBSET (this); 32 | auto *out = c->serializer->embed (this); 33 | if (unlikely (!out)) return_trace (nullptr); 34 | 35 | out->klass = klass_mapping->get (klass); 36 | out->markAnchor.serialize_subset (c, markAnchor, src_base); 37 | return_trace (out); 38 | } 39 | 40 | void collect_variation_indices (hb_collect_variation_indices_context_t *c, 41 | const void *src_base) const 42 | { 43 | (src_base+markAnchor).collect_variation_indices (c); 44 | } 45 | }; 46 | 47 | 48 | } 49 | } 50 | } 51 | 52 | #endif /* OT_LAYOUT_GPOS_MARKRECORD_HH */ 53 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/PairPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_PAIRPOS_HH 2 | #define OT_LAYOUT_GPOS_PAIRPOS_HH 3 | 4 | #include "PairPosFormat1.hh" 5 | #include "PairPosFormat2.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GPOS_impl { 10 | 11 | struct PairPos 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | PairPosFormat1_3 format1; 17 | PairPosFormat2_4 format2; 18 | #ifndef HB_NO_BEYOND_64K 19 | PairPosFormat1_3 format3; 20 | PairPosFormat2_4 format4; 21 | #endif 22 | } u; 23 | 24 | public: 25 | template 26 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 27 | { 28 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 29 | TRACE_DISPATCH (this, u.format); 30 | switch (u.format) { 31 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 32 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 33 | #ifndef HB_NO_BEYOND_64K 34 | case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...)); 35 | case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...)); 36 | #endif 37 | default:return_trace (c->default_return_value ()); 38 | } 39 | } 40 | }; 41 | 42 | } 43 | } 44 | } 45 | 46 | #endif // OT_LAYOUT_GPOS_PAIRPOS_HH 47 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GPOS/PosLookup.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_POSLOOKUP_HH 2 | #define OT_LAYOUT_GPOS_POSLOOKUP_HH 3 | 4 | #include "PosLookupSubTable.hh" 5 | #include "../../../hb-ot-layout-common.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GPOS_impl { 10 | 11 | struct PosLookup : Lookup 12 | { 13 | using SubTable = PosLookupSubTable; 14 | 15 | const SubTable& get_subtable (unsigned int i) const 16 | { return Lookup::get_subtable (i); } 17 | 18 | bool is_reverse () const 19 | { 20 | return false; 21 | } 22 | 23 | bool apply (hb_ot_apply_context_t *c) const 24 | { 25 | TRACE_APPLY (this); 26 | return_trace (dispatch (c)); 27 | } 28 | 29 | bool intersects (const hb_set_t *glyphs) const 30 | { 31 | hb_intersects_context_t c (glyphs); 32 | return dispatch (&c); 33 | } 34 | 35 | hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const 36 | { return dispatch (c); } 37 | 38 | hb_closure_lookups_context_t::return_t closure_lookups (hb_closure_lookups_context_t *c, unsigned this_index) const 39 | { 40 | if (c->is_lookup_visited (this_index)) 41 | return hb_closure_lookups_context_t::default_return_value (); 42 | 43 | c->set_lookup_visited (this_index); 44 | if (!intersects (c->glyphs)) 45 | { 46 | c->set_lookup_inactive (this_index); 47 | return hb_closure_lookups_context_t::default_return_value (); 48 | } 49 | 50 | hb_closure_lookups_context_t::return_t ret = dispatch (c); 51 | return ret; 52 | } 53 | 54 | template 55 | void collect_coverage (set_t *glyphs) const 56 | { 57 | hb_collect_coverage_context_t c (glyphs); 58 | dispatch (&c); 59 | } 60 | 61 | template 62 | static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); 63 | 64 | template 65 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 66 | { return Lookup::dispatch (c, std::forward (ds)...); } 67 | 68 | bool subset (hb_subset_context_t *c) const 69 | { return Lookup::subset (c); } 70 | 71 | bool sanitize (hb_sanitize_context_t *c) const 72 | { return Lookup::sanitize (c); } 73 | }; 74 | 75 | } 76 | } 77 | } 78 | 79 | #endif /* OT_LAYOUT_GPOS_POSLOOKUP_HH */ 80 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/AlternateSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_ALTERNATESUBST_HH 2 | #define OT_LAYOUT_GSUB_ALTERNATESUBST_HH 3 | 4 | #include "AlternateSubstFormat1.hh" 5 | #include "Common.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | struct AlternateSubst 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | AlternateSubstFormat1_2 format1; 17 | #ifndef HB_NO_BEYOND_64K 18 | AlternateSubstFormat1_2 format2; 19 | #endif 20 | } u; 21 | public: 22 | 23 | template 24 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 25 | { 26 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 27 | TRACE_DISPATCH (this, u.format); 28 | switch (u.format) { 29 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 30 | #ifndef HB_NO_BEYOND_64K 31 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 32 | #endif 33 | default:return_trace (c->default_return_value ()); 34 | } 35 | } 36 | 37 | /* TODO This function is unused and not updated to 24bit GIDs. Should be done by using 38 | * iterators. While at it perhaps using iterator of arrays of hb_codepoint_t instead. */ 39 | bool serialize (hb_serialize_context_t *c, 40 | hb_sorted_array_t glyphs, 41 | hb_array_t alternate_len_list, 42 | hb_array_t alternate_glyphs_list) 43 | { 44 | TRACE_SERIALIZE (this); 45 | if (unlikely (!c->extend_min (u.format))) return_trace (false); 46 | unsigned int format = 1; 47 | u.format = format; 48 | switch (u.format) { 49 | case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list)); 50 | default:return_trace (false); 51 | } 52 | } 53 | 54 | /* TODO subset() should choose format. */ 55 | 56 | }; 57 | 58 | } 59 | } 60 | } 61 | 62 | #endif /* OT_LAYOUT_GSUB_ALTERNATESUBST_HH */ 63 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/ChainContextSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_CHAINCONTEXTSUBST_HH 2 | #define OT_LAYOUT_GSUB_CHAINCONTEXTSUBST_HH 3 | 4 | // TODO(garretrieger): move to new layout. 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | #include "Common.hh" 7 | 8 | namespace OT { 9 | namespace Layout { 10 | namespace GSUB_impl { 11 | 12 | struct ChainContextSubst : ChainContext {}; 13 | 14 | } 15 | } 16 | } 17 | 18 | #endif /* OT_LAYOUT_GSUB_CHAINCONTEXTSUBST_HH */ 19 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/Common.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_COMMON_HH 2 | #define OT_LAYOUT_GSUB_COMMON_HH 3 | 4 | #include "../../../hb-serialize.hh" 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | template 12 | static void SingleSubst_serialize (hb_serialize_context_t *c, 13 | Iterator it); 14 | 15 | } 16 | } 17 | } 18 | 19 | #endif /* OT_LAYOUT_GSUB_COMMON_HH */ 20 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/ContextSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_CONTEXTSUBST_HH 2 | #define OT_LAYOUT_GSUB_CONTEXTSUBST_HH 3 | 4 | // TODO(garretrieger): move to new layout. 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | #include "Common.hh" 7 | 8 | namespace OT { 9 | namespace Layout { 10 | namespace GSUB_impl { 11 | 12 | struct ContextSubst : Context {}; 13 | 14 | } 15 | } 16 | } 17 | 18 | #endif /* OT_LAYOUT_GSUB_CONTEXTSUBST_HH */ 19 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/ExtensionSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_EXTENSIONSUBST_HH 2 | #define OT_LAYOUT_GSUB_EXTENSIONSUBST_HH 3 | 4 | // TODO(garretrieger): move to new layout. 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | #include "Common.hh" 7 | 8 | namespace OT { 9 | namespace Layout { 10 | namespace GSUB_impl { 11 | 12 | struct ExtensionSubst : Extension 13 | { 14 | typedef struct SubstLookupSubTable SubTable; 15 | bool is_reverse () const; 16 | }; 17 | 18 | } 19 | } 20 | } 21 | 22 | #endif /* OT_LAYOUT_GSUB_EXTENSIONSUBST_HH */ 23 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/GSUB.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_GSUB_HH 2 | #define OT_LAYOUT_GSUB_GSUB_HH 3 | 4 | #include "../../../hb-ot-layout-gsubgpos.hh" 5 | #include "Common.hh" 6 | #include "SubstLookup.hh" 7 | 8 | namespace OT { 9 | 10 | using Layout::GSUB_impl::SubstLookup; 11 | 12 | namespace Layout { 13 | 14 | /* 15 | * GSUB -- Glyph Substitution 16 | * https://docs.microsoft.com/en-us/typography/opentype/spec/gsub 17 | */ 18 | 19 | struct GSUB : GSUBGPOS 20 | { 21 | using Lookup = SubstLookup; 22 | 23 | static constexpr hb_tag_t tableTag = HB_OT_TAG_GSUB; 24 | 25 | const SubstLookup& get_lookup (unsigned int i) const 26 | { return static_cast (GSUBGPOS::get_lookup (i)); } 27 | 28 | bool subset (hb_subset_context_t *c) const 29 | { 30 | hb_subset_layout_context_t l (c, tableTag); 31 | return GSUBGPOS::subset (&l); 32 | } 33 | 34 | bool sanitize (hb_sanitize_context_t *c) const 35 | { 36 | TRACE_SANITIZE (this); 37 | return_trace (GSUBGPOS::sanitize (c)); 38 | } 39 | 40 | HB_INTERNAL bool is_blocklisted (hb_blob_t *blob, 41 | hb_face_t *face) const; 42 | 43 | void closure_lookups (hb_face_t *face, 44 | const hb_set_t *glyphs, 45 | hb_set_t *lookup_indexes /* IN/OUT */) const 46 | { GSUBGPOS::closure_lookups (face, glyphs, lookup_indexes); } 47 | 48 | typedef GSUBGPOS::accelerator_t accelerator_t; 49 | }; 50 | 51 | 52 | } 53 | 54 | struct GSUB_accelerator_t : Layout::GSUB::accelerator_t { 55 | GSUB_accelerator_t (hb_face_t *face) : Layout::GSUB::accelerator_t (face) {} 56 | }; 57 | 58 | 59 | } 60 | 61 | #endif /* OT_LAYOUT_GSUB_GSUB_HH */ 62 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/MultipleSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_MULTIPLESUBST_HH 2 | #define OT_LAYOUT_GSUB_MULTIPLESUBST_HH 3 | 4 | #include "Common.hh" 5 | #include "MultipleSubstFormat1.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | struct MultipleSubst 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | MultipleSubstFormat1_2 format1; 17 | #ifndef HB_NO_BEYOND_64K 18 | MultipleSubstFormat1_2 format2; 19 | #endif 20 | } u; 21 | 22 | public: 23 | 24 | template 25 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 26 | { 27 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 28 | TRACE_DISPATCH (this, u.format); 29 | switch (u.format) { 30 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 31 | #ifndef HB_NO_BEYOND_64K 32 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 33 | #endif 34 | default:return_trace (c->default_return_value ()); 35 | } 36 | } 37 | 38 | template 40 | bool serialize (hb_serialize_context_t *c, 41 | Iterator it) 42 | { 43 | TRACE_SERIALIZE (this); 44 | if (unlikely (!c->extend_min (u.format))) return_trace (false); 45 | unsigned int format = 1; 46 | u.format = format; 47 | switch (u.format) { 48 | case 1: return_trace (u.format1.serialize (c, it)); 49 | default:return_trace (false); 50 | } 51 | } 52 | 53 | /* TODO subset() should choose format. */ 54 | 55 | }; 56 | 57 | 58 | } 59 | } 60 | } 61 | 62 | #endif /* OT_LAYOUT_GSUB_MULTIPLESUBST_HH */ 63 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/Layout/GSUB/ReverseChainSingleSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_REVERSECHAINSINGLESUBST_HH 2 | #define OT_LAYOUT_GSUB_REVERSECHAINSINGLESUBST_HH 3 | 4 | #include "Common.hh" 5 | #include "ReverseChainSingleSubstFormat1.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | struct ReverseChainSingleSubst 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | ReverseChainSingleSubstFormat1 format1; 17 | } u; 18 | 19 | public: 20 | template 21 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 22 | { 23 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 24 | TRACE_DISPATCH (this, u.format); 25 | switch (u.format) { 26 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 27 | default:return_trace (c->default_return_value ()); 28 | } 29 | } 30 | }; 31 | 32 | } 33 | } 34 | } 35 | 36 | #endif /* HB_OT_LAYOUT_GSUB_REVERSECHAINSINGLESUBST_HH */ 37 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/glyf/GlyphHeader.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_GLYPHHEADER_HH 2 | #define OT_GLYF_GLYPHHEADER_HH 3 | 4 | 5 | #include "../../hb-open-type.hh" 6 | 7 | 8 | namespace OT { 9 | namespace glyf_impl { 10 | 11 | 12 | struct GlyphHeader 13 | { 14 | bool has_data () const { return numberOfContours; } 15 | 16 | template 17 | bool get_extents_without_var_scaled (hb_font_t *font, const accelerator_t &glyf_accelerator, 18 | hb_codepoint_t gid, hb_glyph_extents_t *extents) const 19 | { 20 | /* Undocumented rasterizer behavior: shift glyph to the left by (lsb - xMin), i.e., xMin = lsb */ 21 | /* extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax); */ 22 | int lsb = hb_min (xMin, xMax); 23 | (void) glyf_accelerator.hmtx->get_leading_bearing_without_var_unscaled (gid, &lsb); 24 | extents->x_bearing = lsb; 25 | extents->y_bearing = hb_max (yMin, yMax); 26 | extents->width = hb_max (xMin, xMax) - hb_min (xMin, xMax); 27 | extents->height = hb_min (yMin, yMax) - hb_max (yMin, yMax); 28 | 29 | font->scale_glyph_extents (extents); 30 | 31 | return true; 32 | } 33 | 34 | HBINT16 numberOfContours; 35 | /* If the number of contours is 36 | * greater than or equal to zero, 37 | * this is a simple glyph; if negative, 38 | * this is a composite glyph. */ 39 | FWORD xMin; /* Minimum x for coordinate data. */ 40 | FWORD yMin; /* Minimum y for coordinate data. */ 41 | FWORD xMax; /* Maximum x for coordinate data. */ 42 | FWORD yMax; /* Maximum y for coordinate data. */ 43 | public: 44 | DEFINE_SIZE_STATIC (10); 45 | }; 46 | 47 | 48 | } /* namespace glyf_impl */ 49 | } /* namespace OT */ 50 | 51 | 52 | #endif /* OT_GLYF_GLYPHHEADER_HH */ 53 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/glyf/composite-iter.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_COMPOSITE_ITER_HH 2 | #define OT_GLYF_COMPOSITE_ITER_HH 3 | 4 | 5 | #include "../../hb.hh" 6 | 7 | 8 | namespace OT { 9 | namespace glyf_impl { 10 | 11 | 12 | template 13 | struct composite_iter_tmpl : hb_iter_with_fallback_t, 14 | const CompositeGlyphRecord &> 15 | { 16 | typedef const CompositeGlyphRecord *__item_t__; 17 | composite_iter_tmpl (hb_bytes_t glyph_, __item_t__ current_) : 18 | glyph (glyph_), current (nullptr), current_size (0) 19 | { 20 | set_current (current_); 21 | } 22 | 23 | composite_iter_tmpl () : glyph (hb_bytes_t ()), current (nullptr), current_size (0) {} 24 | 25 | const CompositeGlyphRecord & __item__ () const { return *current; } 26 | bool __more__ () const { return current; } 27 | void __next__ () 28 | { 29 | if (!current->has_more ()) { current = nullptr; return; } 30 | 31 | set_current (&StructAtOffset (current, current_size)); 32 | } 33 | composite_iter_tmpl __end__ () const { return composite_iter_tmpl (); } 34 | bool operator != (const composite_iter_tmpl& o) const 35 | { return current != o.current; } 36 | 37 | 38 | void set_current (__item_t__ current_) 39 | { 40 | if (!glyph.check_range (current_, CompositeGlyphRecord::min_size)) 41 | { 42 | current = nullptr; 43 | current_size = 0; 44 | return; 45 | } 46 | unsigned size = current_->get_size (); 47 | if (!glyph.check_range (current_, size)) 48 | { 49 | current = nullptr; 50 | current_size = 0; 51 | return; 52 | } 53 | 54 | current = current_; 55 | current_size = size; 56 | } 57 | 58 | private: 59 | hb_bytes_t glyph; 60 | __item_t__ current; 61 | unsigned current_size; 62 | }; 63 | 64 | 65 | } /* namespace glyf_impl */ 66 | } /* namespace OT */ 67 | 68 | #endif /* OT_GLYF_COMPOSITE_ITER_HH */ 69 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/glyf/coord-setter.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_COORD_SETTER_HH 2 | #define OT_GLYF_COORD_SETTER_HH 3 | 4 | 5 | #include "../../hb.hh" 6 | 7 | 8 | namespace OT { 9 | namespace glyf_impl { 10 | 11 | 12 | struct coord_setter_t 13 | { 14 | coord_setter_t (hb_array_t coords) : 15 | coords (coords) {} 16 | 17 | int& operator [] (unsigned idx) 18 | { 19 | if (unlikely (idx >= HB_GLYF_VAR_COMPOSITE_MAX_AXES)) 20 | return Crap(int); 21 | if (coords.length < idx + 1) 22 | coords.resize (idx + 1); 23 | return coords[idx]; 24 | } 25 | 26 | hb_array_t get_coords () 27 | { return coords.as_array (); } 28 | 29 | hb_vector_t coords; 30 | }; 31 | 32 | 33 | } /* namespace glyf_impl */ 34 | } /* namespace OT */ 35 | 36 | #endif /* OT_GLYF_COORD_SETTER_HH */ 37 | -------------------------------------------------------------------------------- /include/harfbuzz/OT/glyf/loca.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_LOCA_HH 2 | #define OT_GLYF_LOCA_HH 3 | 4 | 5 | #include "../../hb-open-type.hh" 6 | 7 | 8 | namespace OT { 9 | 10 | 11 | /* 12 | * loca -- Index to Location 13 | * https://docs.microsoft.com/en-us/typography/opentype/spec/loca 14 | */ 15 | #define HB_OT_TAG_loca HB_TAG('l','o','c','a') 16 | 17 | struct loca 18 | { 19 | friend struct glyf; 20 | friend struct glyf_accelerator_t; 21 | 22 | static constexpr hb_tag_t tableTag = HB_OT_TAG_loca; 23 | 24 | bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const 25 | { 26 | TRACE_SANITIZE (this); 27 | return_trace (true); 28 | } 29 | 30 | protected: 31 | UnsizedArrayOf 32 | dataZ; /* Location data. */ 33 | public: 34 | DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always 35 | * check the size externally, allow Null() object of it by 36 | * defining it _MIN instead. */ 37 | }; 38 | 39 | 40 | } /* namespace OT */ 41 | 42 | 43 | #endif /* OT_GLYF_LOCA_HH */ 44 | -------------------------------------------------------------------------------- /include/harfbuzz/addTable.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from fontTools.ttLib import TTFont 3 | from fontTools.ttLib.tables.DefaultTable import DefaultTable 4 | 5 | if len(sys.argv) == 1: 6 | print("usage: python addTable.py input.ttf output.ttf Wasm.bin") 7 | sys.exit(1) 8 | 9 | font = TTFont(sys.argv[1]) 10 | 11 | wasm_table = DefaultTable("Wasm") 12 | wasm_table.data = open(sys.argv[3], "rb").read() 13 | 14 | font["Wasm"] = wasm_table 15 | 16 | font.save(sys.argv[2]) 17 | -------------------------------------------------------------------------------- /include/harfbuzz/failing-alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | int alloc_state = 0; 33 | 34 | __attribute__((no_sanitize("integer"))) 35 | static int fastrand () 36 | { 37 | if (!alloc_state) return 1; 38 | /* Based on https://software.intel.com/content/www/us/en/develop/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor.html */ 39 | alloc_state = (214013 * alloc_state + 2531011); 40 | return (alloc_state >> 16) & 0x7FFF; 41 | } 42 | 43 | void* hb_malloc_impl (size_t size) 44 | { 45 | return (fastrand () % 16) ? malloc (size) : NULL; 46 | } 47 | 48 | void* hb_calloc_impl (size_t nmemb, size_t size) 49 | { 50 | return (fastrand () % 16) ? calloc (nmemb, size) : NULL; 51 | } 52 | 53 | void* hb_realloc_impl (void *ptr, size_t size) 54 | { 55 | return (fastrand () % 16) ? realloc (ptr, size) : NULL; 56 | } 57 | 58 | void hb_free_impl (void *ptr) 59 | { 60 | return free (ptr); 61 | } 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /include/harfbuzz/graph/gsubgpos-context.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Garret Rieger 25 | */ 26 | 27 | #include "graph.hh" 28 | #include "../hb-ot-layout-gsubgpos.hh" 29 | 30 | #ifndef GRAPH_GSUBGPOS_CONTEXT_HH 31 | #define GRAPH_GSUBGPOS_CONTEXT_HH 32 | 33 | namespace graph { 34 | 35 | struct Lookup; 36 | 37 | struct gsubgpos_graph_context_t 38 | { 39 | hb_tag_t table_tag; 40 | graph_t& graph; 41 | unsigned lookup_list_index; 42 | hb_hashmap_t lookups; 43 | 44 | 45 | HB_INTERNAL gsubgpos_graph_context_t (hb_tag_t table_tag_, 46 | graph_t& graph_); 47 | 48 | HB_INTERNAL unsigned create_node (unsigned size); 49 | 50 | bool add_buffer (char* buffer) 51 | { 52 | return graph.add_buffer (buffer); 53 | } 54 | 55 | private: 56 | HB_INTERNAL unsigned num_non_ext_subtables (); 57 | }; 58 | 59 | } 60 | 61 | #endif // GRAPH_GSUBGPOS_CONTEXT 62 | -------------------------------------------------------------------------------- /include/harfbuzz/graph/split-helpers.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Garret Rieger 25 | */ 26 | 27 | #ifndef GRAPH_SPLIT_HELPERS_HH 28 | #define GRAPH_SPLIT_HELPERS_HH 29 | 30 | namespace graph { 31 | 32 | template 33 | HB_INTERNAL 34 | hb_vector_t actuate_subtable_split (Context& split_context, 35 | const hb_vector_t& split_points) 36 | { 37 | hb_vector_t new_objects; 38 | if (!split_points) 39 | return new_objects; 40 | 41 | for (unsigned i = 0; i < split_points.length; i++) 42 | { 43 | unsigned start = split_points[i]; 44 | unsigned end = (i < split_points.length - 1) 45 | ? split_points[i + 1] 46 | : split_context.original_count (); 47 | unsigned id = split_context.clone_range (start, end); 48 | 49 | if (id == (unsigned) -1) 50 | { 51 | new_objects.reset (); 52 | new_objects.allocated = -1; // mark error 53 | return new_objects; 54 | } 55 | new_objects.push (id); 56 | } 57 | 58 | if (!split_context.shrink (split_points[0])) 59 | { 60 | new_objects.reset (); 61 | new_objects.allocated = -1; // mark error 62 | } 63 | 64 | return new_objects; 65 | } 66 | 67 | } 68 | 69 | #endif // GRAPH_SPLIT_HELPERS_HH 70 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-aat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_AAT_H 26 | #define HB_AAT_H 27 | #define HB_AAT_H_IN 28 | 29 | #include "hb.h" 30 | 31 | #include "hb-aat-layout.h" 32 | 33 | HB_BEGIN_DECLS 34 | 35 | HB_END_DECLS 36 | 37 | #undef HB_AAT_H_IN 38 | #endif /* HB_AAT_H */ 39 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-directwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015-2019 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_DIRECTWRITE_H 26 | #define HB_DIRECTWRITE_H 27 | 28 | #include "hb.h" 29 | 30 | HB_BEGIN_DECLS 31 | 32 | HB_EXTERN hb_face_t * 33 | hb_directwrite_face_create (IDWriteFontFace *font_face); 34 | 35 | HB_EXTERN IDWriteFontFace * 36 | hb_directwrite_face_get_font_face (hb_face_t *face); 37 | 38 | HB_END_DECLS 39 | 40 | #endif /* HB_DIRECTWRITE_H */ 41 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-gdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_GDI_H 26 | #define HB_GDI_H 27 | 28 | #include "hb.h" 29 | 30 | #include 31 | 32 | HB_BEGIN_DECLS 33 | 34 | HB_EXTERN hb_face_t * 35 | hb_gdi_face_create (HFONT hfont); 36 | 37 | HB_END_DECLS 38 | 39 | #endif /* HB_GDI_H */ 40 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-glib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * Copyright © 2011 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Red Hat Author(s): Behdad Esfahbod 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_GLIB_H 30 | #define HB_GLIB_H 31 | 32 | #include "hb.h" 33 | 34 | #include 35 | 36 | HB_BEGIN_DECLS 37 | 38 | 39 | HB_EXTERN hb_script_t 40 | hb_glib_script_to_script (GUnicodeScript script); 41 | 42 | HB_EXTERN GUnicodeScript 43 | hb_glib_script_from_script (hb_script_t script); 44 | 45 | 46 | HB_EXTERN hb_unicode_funcs_t * 47 | hb_glib_get_unicode_funcs (void); 48 | 49 | #if GLIB_CHECK_VERSION(2,31,10) 50 | HB_EXTERN hb_blob_t * 51 | hb_glib_blob_create (GBytes *gbytes); 52 | #endif 53 | 54 | HB_END_DECLS 55 | 56 | #endif /* HB_GLIB_H */ 57 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-gobject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_GOBJECT_H 28 | #define HB_GOBJECT_H 29 | #define HB_GOBJECT_H_IN 30 | 31 | #include "hb.h" 32 | 33 | #include "hb-gobject-enums.h" 34 | #include "hb-gobject-structs.h" 35 | 36 | HB_BEGIN_DECLS 37 | HB_END_DECLS 38 | 39 | #undef HB_GOBJECT_H_IN 40 | #endif /* HB_GOBJECT_H */ 41 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-graphite2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Martin Hosken 3 | * Copyright © 2011 SIL International 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | */ 25 | 26 | #ifndef HB_GRAPHITE2_H 27 | #define HB_GRAPHITE2_H 28 | 29 | #include "hb.h" 30 | 31 | #include 32 | 33 | HB_BEGIN_DECLS 34 | 35 | /** 36 | * HB_GRAPHITE2_TAG_SILF: 37 | * 38 | * The #hb_tag_t tag for the `Silf` table, which holds Graphite 39 | * features. 40 | * 41 | * For more information, see http://graphite.sil.org/ 42 | * 43 | **/ 44 | #define HB_GRAPHITE2_TAG_SILF HB_TAG('S','i','l','f') 45 | 46 | 47 | HB_EXTERN gr_face * 48 | hb_graphite2_face_get_gr_face (hb_face_t *face); 49 | 50 | #ifndef HB_DISABLE_DEPRECATED 51 | 52 | HB_DEPRECATED_FOR (hb_graphite2_face_get_gr_face) 53 | HB_EXTERN gr_font * 54 | hb_graphite2_font_get_gr_font (hb_font_t *font); 55 | 56 | #endif 57 | 58 | 59 | HB_END_DECLS 60 | 61 | #endif /* HB_GRAPHITE2_H */ 62 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-icu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * Copyright © 2011 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Red Hat Author(s): Behdad Esfahbod 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_ICU_H 30 | #define HB_ICU_H 31 | 32 | #include "hb.h" 33 | 34 | #include 35 | 36 | HB_BEGIN_DECLS 37 | 38 | 39 | HB_EXTERN hb_script_t 40 | hb_icu_script_to_script (UScriptCode script); 41 | 42 | HB_EXTERN UScriptCode 43 | hb_icu_script_from_script (hb_script_t script); 44 | 45 | 46 | HB_EXTERN hb_unicode_funcs_t * 47 | hb_icu_get_unicode_funcs (void); 48 | 49 | 50 | HB_END_DECLS 51 | 52 | #endif /* HB_ICU_H */ 53 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-number.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | */ 25 | 26 | #ifndef HB_NUMBER_HH 27 | #define HB_NUMBER_HH 28 | 29 | HB_INTERNAL bool 30 | hb_parse_int (const char **pp, const char *end, int *pv, 31 | bool whole_buffer = false); 32 | 33 | HB_INTERNAL bool 34 | hb_parse_uint (const char **pp, const char *end, unsigned int *pv, 35 | bool whole_buffer = false, int base = 10); 36 | 37 | HB_INTERNAL bool 38 | hb_parse_double (const char **pp, const char *end, double *pv, 39 | bool whole_buffer = false); 40 | 41 | #endif /* HB_NUMBER_HH */ 42 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-font.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod, Roozbeh Pournader 25 | */ 26 | 27 | #if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) 28 | #error "Include instead." 29 | #endif 30 | 31 | #ifndef HB_OT_FONT_H 32 | #define HB_OT_FONT_H 33 | 34 | #include "hb.h" 35 | 36 | HB_BEGIN_DECLS 37 | 38 | 39 | HB_EXTERN void 40 | hb_ot_font_set_funcs (hb_font_t *font); 41 | 42 | 43 | HB_END_DECLS 44 | 45 | #endif /* HB_OT_FONT_H */ 46 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-glyf-table.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Google, Inc. 3 | * Copyright © 2019 Adobe Inc. 4 | * Copyright © 2019 Ebrahim Byagowi 5 | * 6 | * This is part of HarfBuzz, a text shaping library. 7 | * 8 | * Permission is hereby granted, without written agreement and without 9 | * license or royalty fees, to use, copy, modify, and distribute this 10 | * software and its documentation for any purpose, provided that the 11 | * above copyright notice and the following two paragraphs appear in 12 | * all copies of this software. 13 | * 14 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 15 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 17 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 18 | * DAMAGE. 19 | * 20 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 21 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 23 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 24 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 25 | * 26 | * Google Author(s): Behdad Esfahbod, Garret Rieger, Roderick Sheeter 27 | * Adobe Author(s): Michiharu Ariza 28 | */ 29 | 30 | #ifndef HB_OT_GLYF_TABLE_HH 31 | #define HB_OT_GLYF_TABLE_HH 32 | 33 | #include "OT/glyf/glyf.hh" 34 | 35 | #endif /* HB_OT_GLYF_TABLE_HH */ 36 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-layout-gdef-table.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2007,2008,2009 Red Hat, Inc. 3 | * Copyright © 2010,2011,2012 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Red Hat Author(s): Behdad Esfahbod 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_OT_LAYOUT_GDEF_TABLE_HH 30 | #define HB_OT_LAYOUT_GDEF_TABLE_HH 31 | 32 | #include "OT/Layout/GDEF/GDEF.hh" 33 | 34 | #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ 35 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-metrics.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_OT_METRICS_HH 26 | #define HB_OT_METRICS_HH 27 | 28 | #include "hb.hh" 29 | 30 | HB_INTERNAL bool 31 | _hb_ot_metrics_get_position_common (hb_font_t *font, 32 | hb_ot_metrics_tag_t metrics_tag, 33 | hb_position_t *position /* OUT. May be NULL. */); 34 | 35 | #endif /* HB_OT_METRICS_HH */ 36 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-name-language.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_NAME_LANGUAGE_HH 28 | #define HB_OT_NAME_LANGUAGE_HH 29 | 30 | #include "hb.hh" 31 | 32 | 33 | HB_INTERNAL hb_language_t 34 | _hb_ot_name_language_for_ms_code (unsigned int code); 35 | 36 | HB_INTERNAL hb_language_t 37 | _hb_ot_name_language_for_mac_code (unsigned int code); 38 | 39 | 40 | #endif /* HB_OT_NAME_LANGUAGE_HH */ 41 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-name-table.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011,2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_NAME_TABLE_HH 28 | #define HB_OT_NAME_TABLE_HH 29 | 30 | #include "OT/name/name.hh" 31 | 32 | #endif /* HB_OT_NAME_TABLE_HH */ 33 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shape-fallback.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_SHAPE_FALLBACK_HH 28 | #define HB_OT_SHAPE_FALLBACK_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-ot-shape.hh" 33 | 34 | 35 | HB_INTERNAL void _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, 36 | hb_font_t *font, 37 | hb_buffer_t *buffer, 38 | bool adjust_offsets_when_zeroing); 39 | 40 | HB_INTERNAL void _hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t *plan, 41 | hb_font_t *font, 42 | hb_buffer_t *buffer); 43 | 44 | 45 | HB_INTERNAL void _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, 46 | hb_font_t *font, 47 | hb_buffer_t *buffer); 48 | 49 | HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan, 50 | hb_font_t *font, 51 | hb_buffer_t *buffer); 52 | 53 | 54 | #endif /* HB_OT_SHAPE_FALLBACK_HH */ 55 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shape.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2013 Red Hat, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Red Hat Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) 28 | #error "Include instead." 29 | #endif 30 | 31 | #ifndef HB_OT_SHAPE_H 32 | #define HB_OT_SHAPE_H 33 | 34 | #include "hb.h" 35 | 36 | HB_BEGIN_DECLS 37 | 38 | /* TODO port to shape-plan / set. */ 39 | HB_EXTERN void 40 | hb_ot_shape_glyphs_closure (hb_font_t *font, 41 | hb_buffer_t *buffer, 42 | const hb_feature_t *features, 43 | unsigned int num_features, 44 | hb_set_t *glyphs); 45 | 46 | HB_EXTERN void 47 | hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan, 48 | hb_tag_t table_tag, 49 | hb_set_t *lookup_indexes /* OUT */); 50 | 51 | HB_END_DECLS 52 | 53 | #endif /* HB_OT_SHAPE_H */ 54 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shaper-arabic-joining-list.hh: -------------------------------------------------------------------------------- 1 | /* == Start of generated function == */ 2 | /* 3 | * The following function is generated by running: 4 | * 5 | * ./gen-arabic-joining-list.py ArabicShaping.txt Scripts.txt 6 | * 7 | * on files with these headers: 8 | * 9 | * # ArabicShaping-15.0.0.txt 10 | * # Date: 2022-02-14, 18:50:00 GMT [KW, RP] 11 | * # Scripts-15.0.0.txt 12 | * # Date: 2022-04-26, 23:15:02 GMT 13 | */ 14 | 15 | #ifndef HB_OT_SHAPER_ARABIC_JOINING_LIST_HH 16 | #define HB_OT_SHAPER_ARABIC_JOINING_LIST_HH 17 | 18 | static bool 19 | has_arabic_joining (hb_script_t script) 20 | { 21 | /* List of scripts that have data in arabic-table. */ 22 | switch ((int) script) 23 | { 24 | case HB_SCRIPT_ADLAM: 25 | case HB_SCRIPT_ARABIC: 26 | case HB_SCRIPT_CHORASMIAN: 27 | case HB_SCRIPT_HANIFI_ROHINGYA: 28 | case HB_SCRIPT_MANDAIC: 29 | case HB_SCRIPT_MANICHAEAN: 30 | case HB_SCRIPT_MONGOLIAN: 31 | case HB_SCRIPT_NKO: 32 | case HB_SCRIPT_OLD_UYGHUR: 33 | case HB_SCRIPT_PHAGS_PA: 34 | case HB_SCRIPT_PSALTER_PAHLAVI: 35 | case HB_SCRIPT_SOGDIAN: 36 | case HB_SCRIPT_SYRIAC: 37 | return true; 38 | 39 | default: 40 | return false; 41 | } 42 | } 43 | 44 | 45 | #endif /* HB_OT_SHAPER_ARABIC_JOINING_LIST_HH */ 46 | 47 | /* == End of generated function == */ 48 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shaper-arabic.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Mozilla Foundation. 3 | * Copyright © 2015 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Mozilla Author(s): Jonathan Kew 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_OT_SHAPER_ARABIC_HH 30 | #define HB_OT_SHAPER_ARABIC_HH 31 | 32 | #include "hb.hh" 33 | 34 | #include "hb-ot-shaper.hh" 35 | 36 | 37 | struct arabic_shape_plan_t; 38 | 39 | HB_INTERNAL void * 40 | data_create_arabic (const hb_ot_shape_plan_t *plan); 41 | 42 | HB_INTERNAL void 43 | data_destroy_arabic (void *data); 44 | 45 | HB_INTERNAL void 46 | setup_masks_arabic_plan (const arabic_shape_plan_t *arabic_plan, 47 | hb_buffer_t *buffer, 48 | hb_script_t script); 49 | 50 | #endif /* HB_OT_SHAPER_ARABIC_HH */ 51 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shaper-indic.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_SHAPER_INDIC_HH 28 | #define HB_OT_SHAPER_INDIC_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-ot-shaper-syllabic.hh" 33 | 34 | 35 | /* Visual positions in a syllable from left to right. */ 36 | enum ot_position_t { 37 | POS_START = 0, 38 | 39 | POS_RA_TO_BECOME_REPH = 1, 40 | POS_PRE_M = 2, 41 | POS_PRE_C = 3, 42 | 43 | POS_BASE_C = 4, 44 | POS_AFTER_MAIN = 5, 45 | 46 | POS_ABOVE_C = 6, 47 | 48 | POS_BEFORE_SUB = 7, 49 | POS_BELOW_C = 8, 50 | POS_AFTER_SUB = 9, 51 | 52 | POS_BEFORE_POST = 10, 53 | POS_POST_C = 11, 54 | POS_AFTER_POST = 12, 55 | 56 | POS_SMVD = 13, 57 | 58 | POS_END = 14 59 | }; 60 | 61 | 62 | HB_INTERNAL uint16_t 63 | hb_indic_get_categories (hb_codepoint_t u); 64 | 65 | 66 | #endif /* HB_OT_SHAPER_INDIC_HH */ 67 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shaper-syllabic.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Behdad Esfahbod. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_OT_SHAPER_SYLLABIC_HH 26 | #define HB_OT_SHAPER_SYLLABIC_HH 27 | 28 | #include "hb.hh" 29 | 30 | #include "hb-ot-shaper.hh" 31 | 32 | 33 | HB_INTERNAL bool 34 | hb_syllabic_insert_dotted_circles (hb_font_t *font, 35 | hb_buffer_t *buffer, 36 | unsigned int broken_syllable_type, 37 | unsigned int dottedcircle_category, 38 | int repha_category = -1, 39 | int dottedcircle_position = -1); 40 | 41 | HB_INTERNAL bool 42 | hb_syllabic_clear_var (const hb_ot_shape_plan_t *plan, 43 | hb_font_t *font, 44 | hb_buffer_t *buffer); 45 | 46 | 47 | #endif /* HB_OT_SHAPER_SYLLABIC_HH */ 48 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot-shaper-vowel-constraints.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_SHAPER_VOWEL_CONSTRAINTS_HH 28 | #define HB_OT_SHAPER_VOWEL_CONSTRAINTS_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-ot-shaper.hh" 33 | 34 | HB_INTERNAL void 35 | _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan, 36 | hb_buffer_t *buffer, 37 | hb_font_t *font); 38 | 39 | #endif /* HB_OT_SHAPER_VOWEL_CONSTRAINTS_HH */ 40 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-ot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Red Hat Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_H 28 | #define HB_OT_H 29 | #define HB_OT_H_IN 30 | 31 | #include "hb.h" 32 | 33 | #include "hb-ot-color.h" 34 | #include "hb-ot-deprecated.h" 35 | #include "hb-ot-font.h" 36 | #include "hb-ot-layout.h" 37 | #include "hb-ot-math.h" 38 | #include "hb-ot-meta.h" 39 | #include "hb-ot-metrics.h" 40 | #include "hb-ot-name.h" 41 | #include "hb-ot-shape.h" 42 | #include "hb-ot-var.h" 43 | 44 | HB_BEGIN_DECLS 45 | 46 | HB_END_DECLS 47 | 48 | #undef HB_OT_H_IN 49 | #endif /* HB_OT_H */ 50 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-outline.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_OUTLINE_HH 26 | #define HB_OUTLINE_HH 27 | 28 | #include "hb.hh" 29 | 30 | #include "hb-draw.hh" 31 | 32 | 33 | struct hb_outline_point_t 34 | { 35 | enum class type_t 36 | { 37 | MOVE_TO, 38 | LINE_TO, 39 | QUADRATIC_TO, 40 | CUBIC_TO, 41 | }; 42 | 43 | hb_outline_point_t (float x, float y, type_t type) : 44 | x (x), y (y), type (type) {} 45 | 46 | float x, y; 47 | type_t type; 48 | }; 49 | 50 | struct hb_outline_vector_t 51 | { 52 | float normalize_len () 53 | { 54 | float len = hypotf (x, y); 55 | if (len) 56 | { 57 | x /= len; 58 | y /= len; 59 | } 60 | return len; 61 | } 62 | 63 | float x, y; 64 | }; 65 | 66 | struct hb_outline_t 67 | { 68 | void reset () { points.shrink (0, false); contours.resize (0); } 69 | 70 | HB_INTERNAL void replay (hb_draw_funcs_t *pen, void *pen_data) const; 71 | HB_INTERNAL float control_area () const; 72 | HB_INTERNAL void embolden (float x_strength, float y_strength, 73 | float x_shift, float y_shift); 74 | 75 | hb_vector_t points; 76 | hb_vector_t contours; 77 | }; 78 | 79 | HB_INTERNAL hb_draw_funcs_t * 80 | hb_outline_recording_pen_get_funcs (); 81 | 82 | 83 | #endif /* HB_OUTLINE_HH */ 84 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-shaper-impl.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_SHAPER_IMPL_HH 28 | #define HB_SHAPER_IMPL_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-shaper.hh" 33 | #include "hb-face.hh" 34 | #include "hb-font.hh" 35 | #include "hb-shape-plan.hh" 36 | #include "hb-buffer.hh" 37 | 38 | #endif /* HB_SHAPER_IMPL_HH */ 39 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-shaper-list.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_SHAPER_LIST_HH 28 | #define HB_SHAPER_LIST_HH 29 | #endif /* HB_SHAPER_LIST_HH */ /* Dummy header guards */ 30 | 31 | #ifndef HB_NO_SHAPER 32 | 33 | 34 | /* v--- Add new shapers in the right place here. */ 35 | 36 | #ifdef HAVE_WASM 37 | /* Only picks up fonts that have a "Wasm" table. */ 38 | HB_SHAPER_IMPLEMENT (wasm) 39 | #endif 40 | 41 | #ifdef HAVE_GRAPHITE2 42 | /* Only picks up fonts that have a "Silf" table. */ 43 | HB_SHAPER_IMPLEMENT (graphite2) 44 | #endif 45 | 46 | #ifndef HB_NO_OT_SHAPE 47 | HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main shaper. */ 48 | #endif 49 | 50 | #ifdef HAVE_UNISCRIBE 51 | HB_SHAPER_IMPLEMENT (uniscribe) 52 | #endif 53 | #ifdef HAVE_DIRECTWRITE 54 | HB_SHAPER_IMPLEMENT (directwrite) 55 | #endif 56 | #ifdef HAVE_CORETEXT 57 | HB_SHAPER_IMPLEMENT (coretext) 58 | #endif 59 | 60 | #ifndef HB_NO_FALLBACK_SHAPE 61 | HB_SHAPER_IMPLEMENT (fallback) /* <--- This should be last. */ 62 | #endif 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-uniscribe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_UNISCRIBE_H 28 | #define HB_UNISCRIBE_H 29 | 30 | #include "hb.h" 31 | 32 | #include 33 | 34 | HB_BEGIN_DECLS 35 | 36 | 37 | HB_EXTERN LOGFONTW * 38 | hb_uniscribe_font_get_logfontw (hb_font_t *font); 39 | 40 | HB_EXTERN HFONT 41 | hb_uniscribe_font_get_hfont (hb_font_t *font); 42 | 43 | 44 | HB_END_DECLS 45 | 46 | #endif /* HB_UNISCRIBE_H */ 47 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-wasm-api-blob.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_WASM_API_BLOB_HH 26 | #define HB_WASM_API_BLOB_HH 27 | 28 | #include "hb-wasm-api.hh" 29 | 30 | namespace hb { 31 | namespace wasm { 32 | 33 | 34 | HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV 35 | ptr_d(blob_t, blob)) 36 | { 37 | HB_PTR_PARAM (blob_t, blob); 38 | if (unlikely (!blob)) 39 | return; 40 | 41 | module_free (blob->data); 42 | 43 | blob->data = nullref; 44 | blob->length = 0; 45 | } 46 | 47 | 48 | }} 49 | 50 | #endif /* HB_WASM_API_BLOB_HH */ 51 | -------------------------------------------------------------------------------- /include/harfbuzz/hb-wasm-api-common.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_WASM_API_COMMON_HH 26 | #define HB_WASM_API_COMMON_HH 27 | 28 | #include "hb-wasm-api.hh" 29 | 30 | namespace hb { 31 | namespace wasm { 32 | 33 | 34 | HB_WASM_API (direction_t, script_get_horizontal_direction) (HB_WASM_EXEC_ENV 35 | script_t script) 36 | { 37 | return (direction_t) 38 | hb_script_get_horizontal_direction (hb_script_from_iso15924_tag (script)); 39 | } 40 | 41 | 42 | }} 43 | 44 | #endif /* HB_WASM_API_COMMON_HH */ 45 | -------------------------------------------------------------------------------- /include/harfbuzz/hb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Red Hat Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_H 28 | #define HB_H 29 | #define HB_H_IN 30 | 31 | #include "hb-blob.h" 32 | #include "hb-buffer.h" 33 | #include "hb-common.h" 34 | #include "hb-deprecated.h" 35 | #include "hb-draw.h" 36 | #include "hb-face.h" 37 | #include "hb-font.h" 38 | #include "hb-map.h" 39 | #include "hb-paint.h" 40 | #include "hb-set.h" 41 | #include "hb-shape.h" 42 | #include "hb-shape-plan.h" 43 | #include "hb-style.h" 44 | #include "hb-unicode.h" 45 | #include "hb-version.h" 46 | 47 | HB_BEGIN_DECLS 48 | HB_END_DECLS 49 | 50 | #undef HB_H_IN 51 | #endif /* HB_H */ 52 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/AnchorFormat1.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_ANCHORFORMAT1_HH 2 | #define OT_LAYOUT_GPOS_ANCHORFORMAT1_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct AnchorFormat1 9 | { 10 | protected: 11 | HBUINT16 format; /* Format identifier--format = 1 */ 12 | FWORD xCoordinate; /* Horizontal value--in design units */ 13 | FWORD yCoordinate; /* Vertical value--in design units */ 14 | public: 15 | DEFINE_SIZE_STATIC (6); 16 | 17 | bool sanitize (hb_sanitize_context_t *c) const 18 | { 19 | TRACE_SANITIZE (this); 20 | return_trace (c->check_struct (this)); 21 | } 22 | 23 | void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, 24 | float *x, float *y) const 25 | { 26 | hb_font_t *font = c->font; 27 | *x = font->em_fscale_x (xCoordinate); 28 | *y = font->em_fscale_y (yCoordinate); 29 | } 30 | 31 | AnchorFormat1* copy (hb_serialize_context_t *c) const 32 | { 33 | TRACE_SERIALIZE (this); 34 | AnchorFormat1* out = c->embed (this); 35 | if (!out) return_trace (out); 36 | out->format = 1; 37 | return_trace (out); 38 | } 39 | }; 40 | 41 | 42 | } 43 | } 44 | } 45 | 46 | #endif // OT_LAYOUT_GPOS_ANCHORFORMAT1_HH 47 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/AnchorFormat2.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_ANCHORFORMAT2_HH 2 | #define OT_LAYOUT_GPOS_ANCHORFORMAT2_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct AnchorFormat2 9 | { 10 | 11 | protected: 12 | HBUINT16 format; /* Format identifier--format = 2 */ 13 | FWORD xCoordinate; /* Horizontal value--in design units */ 14 | FWORD yCoordinate; /* Vertical value--in design units */ 15 | HBUINT16 anchorPoint; /* Index to glyph contour point */ 16 | public: 17 | DEFINE_SIZE_STATIC (8); 18 | 19 | bool sanitize (hb_sanitize_context_t *c) const 20 | { 21 | TRACE_SANITIZE (this); 22 | return_trace (c->check_struct (this)); 23 | } 24 | 25 | void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id, 26 | float *x, float *y) const 27 | { 28 | hb_font_t *font = c->font; 29 | 30 | #ifdef HB_NO_HINTING 31 | *x = font->em_fscale_x (xCoordinate); 32 | *y = font->em_fscale_y (yCoordinate); 33 | return; 34 | #endif 35 | 36 | unsigned int x_ppem = font->x_ppem; 37 | unsigned int y_ppem = font->y_ppem; 38 | hb_position_t cx = 0, cy = 0; 39 | bool ret; 40 | 41 | ret = (x_ppem || y_ppem) && 42 | font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy); 43 | *x = ret && x_ppem ? cx : font->em_fscale_x (xCoordinate); 44 | *y = ret && y_ppem ? cy : font->em_fscale_y (yCoordinate); 45 | } 46 | 47 | AnchorFormat2* copy (hb_serialize_context_t *c) const 48 | { 49 | TRACE_SERIALIZE (this); 50 | return_trace (c->embed (this)); 51 | } 52 | }; 53 | 54 | } 55 | } 56 | } 57 | 58 | #endif // OT_LAYOUT_GPOS_ANCHORFORMAT2_HH 59 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/ChainContextPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_CHAINCONTEXTPOS_HH 2 | #define OT_LAYOUT_GPOS_CHAINCONTEXTPOS_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct ChainContextPos : ChainContext {}; 9 | 10 | } 11 | } 12 | } 13 | 14 | #endif /* OT_LAYOUT_GPOS_CHAINCONTEXTPOS_HH */ 15 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/Common.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_COMMON_HH 2 | #define OT_LAYOUT_GPOS_COMMON_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | enum attach_type_t { 9 | ATTACH_TYPE_NONE = 0X00, 10 | 11 | /* Each attachment should be either a mark or a cursive; can't be both. */ 12 | ATTACH_TYPE_MARK = 0X01, 13 | ATTACH_TYPE_CURSIVE = 0X02, 14 | }; 15 | 16 | /* buffer **position** var allocations */ 17 | #define attach_chain() var.i16[0] /* glyph to which this attaches to, relative to current glyphs; negative for going back, positive for forward. */ 18 | #define attach_type() var.u8[2] /* attachment type */ 19 | /* Note! if attach_chain() is zero, the value of attach_type() is irrelevant. */ 20 | 21 | template 22 | static void SinglePos_serialize (hb_serialize_context_t *c, 23 | const SrcLookup *src, 24 | Iterator it, 25 | const hb_hashmap_t> *layout_variation_idx_delta_map, 26 | bool all_axes_pinned); 27 | 28 | 29 | } 30 | } 31 | } 32 | 33 | #endif // OT_LAYOUT_GPOS_COMMON_HH 34 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/ContextPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_CONTEXTPOS_HH 2 | #define OT_LAYOUT_GPOS_CONTEXTPOS_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct ContextPos : Context {}; 9 | 10 | } 11 | } 12 | } 13 | 14 | #endif /* OT_LAYOUT_GPOS_CONTEXTPOS_HH */ 15 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/CursivePos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_CURSIVEPOS_HH 2 | #define OT_LAYOUT_GPOS_CURSIVEPOS_HH 3 | 4 | #include "CursivePosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct CursivePos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | CursivePosFormat1 format1; 16 | } u; 17 | 18 | public: 19 | template 20 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 21 | { 22 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 23 | TRACE_DISPATCH (this, u.format); 24 | switch (u.format) { 25 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 26 | default:return_trace (c->default_return_value ()); 27 | } 28 | } 29 | }; 30 | 31 | } 32 | } 33 | } 34 | 35 | #endif /* OT_LAYOUT_GPOS_CURSIVEPOS_HH */ 36 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/ExtensionPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_EXTENSIONPOS_HH 2 | #define OT_LAYOUT_GPOS_EXTENSIONPOS_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct ExtensionPos : Extension 9 | { 10 | typedef struct PosLookupSubTable SubTable; 11 | }; 12 | 13 | } 14 | } 15 | } 16 | 17 | #endif /* OT_LAYOUT_GPOS_EXTENSIONPOS_HH */ 18 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/LigatureArray.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_LIGATUREARRAY_HH 2 | #define OT_LAYOUT_GPOS_LIGATUREARRAY_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | 9 | typedef AnchorMatrix LigatureAttach; /* component-major-- 10 | * in order of writing direction--, 11 | * mark-minor-- 12 | * ordered by class--zero-based. */ 13 | 14 | /* Array of LigatureAttach tables ordered by LigatureCoverage Index */ 15 | struct LigatureArray : List16OfOffset16To 16 | { 17 | template 19 | bool subset (hb_subset_context_t *c, 20 | Iterator coverage, 21 | unsigned class_count, 22 | const hb_map_t *klass_mapping) const 23 | { 24 | TRACE_SUBSET (this); 25 | const hb_set_t &glyphset = *c->plan->glyphset_gsub (); 26 | 27 | auto *out = c->serializer->start_embed (this); 28 | if (unlikely (!c->serializer->extend_min (out))) return_trace (false); 29 | 30 | for (const auto _ : + hb_zip (coverage, *this) 31 | | hb_filter (glyphset, hb_first)) 32 | { 33 | auto *matrix = out->serialize_append (c->serializer); 34 | if (unlikely (!matrix)) return_trace (false); 35 | 36 | const LigatureAttach& src = (this + _.second); 37 | auto indexes = 38 | + hb_range (src.rows * class_count) 39 | | hb_filter ([=] (unsigned index) { return klass_mapping->has (index % class_count); }) 40 | ; 41 | matrix->serialize_subset (c, 42 | _.second, 43 | this, 44 | src.rows, 45 | indexes); 46 | } 47 | return_trace (this->len); 48 | } 49 | }; 50 | 51 | 52 | } 53 | } 54 | } 55 | 56 | #endif /* OT_LAYOUT_GPOS_LIGATUREARRAY_HH */ 57 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/MarkBasePos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKBASEPOS_HH 2 | #define OT_LAYOUT_GPOS_MARKBASEPOS_HH 3 | 4 | #include "MarkBasePosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct MarkBasePos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | MarkBasePosFormat1_2 format1; 16 | #ifndef HB_NO_BEYOND_64K 17 | MarkBasePosFormat1_2 format2; 18 | #endif 19 | } u; 20 | 21 | public: 22 | template 23 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 24 | { 25 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 26 | TRACE_DISPATCH (this, u.format); 27 | switch (u.format) { 28 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 29 | #ifndef HB_NO_BEYOND_64K 30 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 31 | #endif 32 | default:return_trace (c->default_return_value ()); 33 | } 34 | } 35 | }; 36 | 37 | } 38 | } 39 | } 40 | 41 | #endif /* OT_LAYOUT_GPOS_MARKBASEPOS_HH */ 42 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/MarkLigPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKLIGPOS_HH 2 | #define OT_LAYOUT_GPOS_MARKLIGPOS_HH 3 | 4 | #include "MarkLigPosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct MarkLigPos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | MarkLigPosFormat1_2 format1; 16 | #ifndef HB_NO_BEYOND_64K 17 | MarkLigPosFormat1_2 format2; 18 | #endif 19 | } u; 20 | 21 | public: 22 | template 23 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 24 | { 25 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 26 | TRACE_DISPATCH (this, u.format); 27 | switch (u.format) { 28 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 29 | #ifndef HB_NO_BEYOND_64K 30 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 31 | #endif 32 | default:return_trace (c->default_return_value ()); 33 | } 34 | } 35 | }; 36 | 37 | } 38 | } 39 | } 40 | 41 | #endif /* OT_LAYOUT_GPOS_MARKLIGPOS_HH */ 42 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/MarkMarkPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKMARKPOS_HH 2 | #define OT_LAYOUT_GPOS_MARKMARKPOS_HH 3 | 4 | #include "MarkMarkPosFormat1.hh" 5 | 6 | namespace OT { 7 | namespace Layout { 8 | namespace GPOS_impl { 9 | 10 | struct MarkMarkPos 11 | { 12 | protected: 13 | union { 14 | HBUINT16 format; /* Format identifier */ 15 | MarkMarkPosFormat1_2 format1; 16 | #ifndef HB_NO_BEYOND_64K 17 | MarkMarkPosFormat1_2 format2; 18 | #endif 19 | } u; 20 | 21 | public: 22 | template 23 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 24 | { 25 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 26 | TRACE_DISPATCH (this, u.format); 27 | switch (u.format) { 28 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 29 | #ifndef HB_NO_BEYOND_64K 30 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 31 | #endif 32 | default:return_trace (c->default_return_value ()); 33 | } 34 | } 35 | }; 36 | 37 | 38 | } 39 | } 40 | } 41 | 42 | #endif /* OT_LAYOUT_GPOS_MARKMARKPOS_HH */ 43 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/MarkRecord.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_MARKRECORD_HH 2 | #define OT_LAYOUT_GPOS_MARKRECORD_HH 3 | 4 | namespace OT { 5 | namespace Layout { 6 | namespace GPOS_impl { 7 | 8 | struct MarkRecord 9 | { 10 | friend struct MarkArray; 11 | 12 | public: 13 | HBUINT16 klass; /* Class defined for this mark */ 14 | Offset16To 15 | markAnchor; /* Offset to Anchor table--from 16 | * beginning of MarkArray table */ 17 | public: 18 | DEFINE_SIZE_STATIC (4); 19 | 20 | unsigned get_class () const { return (unsigned) klass; } 21 | bool sanitize (hb_sanitize_context_t *c, const void *base) const 22 | { 23 | TRACE_SANITIZE (this); 24 | return_trace (c->check_struct (this) && markAnchor.sanitize (c, base)); 25 | } 26 | 27 | MarkRecord *subset (hb_subset_context_t *c, 28 | const void *src_base, 29 | const hb_map_t *klass_mapping) const 30 | { 31 | TRACE_SUBSET (this); 32 | auto *out = c->serializer->embed (this); 33 | if (unlikely (!out)) return_trace (nullptr); 34 | 35 | out->klass = klass_mapping->get (klass); 36 | out->markAnchor.serialize_subset (c, markAnchor, src_base); 37 | return_trace (out); 38 | } 39 | 40 | void collect_variation_indices (hb_collect_variation_indices_context_t *c, 41 | const void *src_base) const 42 | { 43 | (src_base+markAnchor).collect_variation_indices (c); 44 | } 45 | }; 46 | 47 | 48 | } 49 | } 50 | } 51 | 52 | #endif /* OT_LAYOUT_GPOS_MARKRECORD_HH */ 53 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/PairPos.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_PAIRPOS_HH 2 | #define OT_LAYOUT_GPOS_PAIRPOS_HH 3 | 4 | #include "PairPosFormat1.hh" 5 | #include "PairPosFormat2.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GPOS_impl { 10 | 11 | struct PairPos 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | PairPosFormat1_3 format1; 17 | PairPosFormat2_4 format2; 18 | #ifndef HB_NO_BEYOND_64K 19 | PairPosFormat1_3 format3; 20 | PairPosFormat2_4 format4; 21 | #endif 22 | } u; 23 | 24 | public: 25 | template 26 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 27 | { 28 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 29 | TRACE_DISPATCH (this, u.format); 30 | switch (u.format) { 31 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 32 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 33 | #ifndef HB_NO_BEYOND_64K 34 | case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...)); 35 | case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...)); 36 | #endif 37 | default:return_trace (c->default_return_value ()); 38 | } 39 | } 40 | }; 41 | 42 | } 43 | } 44 | } 45 | 46 | #endif // OT_LAYOUT_GPOS_PAIRPOS_HH 47 | -------------------------------------------------------------------------------- /src/OT/Layout/GPOS/PosLookup.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GPOS_POSLOOKUP_HH 2 | #define OT_LAYOUT_GPOS_POSLOOKUP_HH 3 | 4 | #include "PosLookupSubTable.hh" 5 | #include "../../../hb-ot-layout-common.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GPOS_impl { 10 | 11 | struct PosLookup : Lookup 12 | { 13 | using SubTable = PosLookupSubTable; 14 | 15 | const SubTable& get_subtable (unsigned int i) const 16 | { return Lookup::get_subtable (i); } 17 | 18 | bool is_reverse () const 19 | { 20 | return false; 21 | } 22 | 23 | bool apply (hb_ot_apply_context_t *c) const 24 | { 25 | TRACE_APPLY (this); 26 | return_trace (dispatch (c)); 27 | } 28 | 29 | bool intersects (const hb_set_t *glyphs) const 30 | { 31 | hb_intersects_context_t c (glyphs); 32 | return dispatch (&c); 33 | } 34 | 35 | hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const 36 | { return dispatch (c); } 37 | 38 | hb_closure_lookups_context_t::return_t closure_lookups (hb_closure_lookups_context_t *c, unsigned this_index) const 39 | { 40 | if (c->is_lookup_visited (this_index)) 41 | return hb_closure_lookups_context_t::default_return_value (); 42 | 43 | c->set_lookup_visited (this_index); 44 | if (!intersects (c->glyphs)) 45 | { 46 | c->set_lookup_inactive (this_index); 47 | return hb_closure_lookups_context_t::default_return_value (); 48 | } 49 | 50 | hb_closure_lookups_context_t::return_t ret = dispatch (c); 51 | return ret; 52 | } 53 | 54 | template 55 | void collect_coverage (set_t *glyphs) const 56 | { 57 | hb_collect_coverage_context_t c (glyphs); 58 | dispatch (&c); 59 | } 60 | 61 | template 62 | static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); 63 | 64 | template 65 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 66 | { return Lookup::dispatch (c, std::forward (ds)...); } 67 | 68 | bool subset (hb_subset_context_t *c) const 69 | { return Lookup::subset (c); } 70 | 71 | bool sanitize (hb_sanitize_context_t *c) const 72 | { return Lookup::sanitize (c); } 73 | }; 74 | 75 | } 76 | } 77 | } 78 | 79 | #endif /* OT_LAYOUT_GPOS_POSLOOKUP_HH */ 80 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/AlternateSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_ALTERNATESUBST_HH 2 | #define OT_LAYOUT_GSUB_ALTERNATESUBST_HH 3 | 4 | #include "AlternateSubstFormat1.hh" 5 | #include "Common.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | struct AlternateSubst 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | AlternateSubstFormat1_2 format1; 17 | #ifndef HB_NO_BEYOND_64K 18 | AlternateSubstFormat1_2 format2; 19 | #endif 20 | } u; 21 | public: 22 | 23 | template 24 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 25 | { 26 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 27 | TRACE_DISPATCH (this, u.format); 28 | switch (u.format) { 29 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 30 | #ifndef HB_NO_BEYOND_64K 31 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 32 | #endif 33 | default:return_trace (c->default_return_value ()); 34 | } 35 | } 36 | 37 | /* TODO This function is unused and not updated to 24bit GIDs. Should be done by using 38 | * iterators. While at it perhaps using iterator of arrays of hb_codepoint_t instead. */ 39 | bool serialize (hb_serialize_context_t *c, 40 | hb_sorted_array_t glyphs, 41 | hb_array_t alternate_len_list, 42 | hb_array_t alternate_glyphs_list) 43 | { 44 | TRACE_SERIALIZE (this); 45 | if (unlikely (!c->extend_min (u.format))) return_trace (false); 46 | unsigned int format = 1; 47 | u.format = format; 48 | switch (u.format) { 49 | case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list)); 50 | default:return_trace (false); 51 | } 52 | } 53 | 54 | /* TODO subset() should choose format. */ 55 | 56 | }; 57 | 58 | } 59 | } 60 | } 61 | 62 | #endif /* OT_LAYOUT_GSUB_ALTERNATESUBST_HH */ 63 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/ChainContextSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_CHAINCONTEXTSUBST_HH 2 | #define OT_LAYOUT_GSUB_CHAINCONTEXTSUBST_HH 3 | 4 | // TODO(garretrieger): move to new layout. 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | #include "Common.hh" 7 | 8 | namespace OT { 9 | namespace Layout { 10 | namespace GSUB_impl { 11 | 12 | struct ChainContextSubst : ChainContext {}; 13 | 14 | } 15 | } 16 | } 17 | 18 | #endif /* OT_LAYOUT_GSUB_CHAINCONTEXTSUBST_HH */ 19 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/Common.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_COMMON_HH 2 | #define OT_LAYOUT_GSUB_COMMON_HH 3 | 4 | #include "../../../hb-serialize.hh" 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | template 12 | static void SingleSubst_serialize (hb_serialize_context_t *c, 13 | Iterator it); 14 | 15 | } 16 | } 17 | } 18 | 19 | #endif /* OT_LAYOUT_GSUB_COMMON_HH */ 20 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/ContextSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_CONTEXTSUBST_HH 2 | #define OT_LAYOUT_GSUB_CONTEXTSUBST_HH 3 | 4 | // TODO(garretrieger): move to new layout. 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | #include "Common.hh" 7 | 8 | namespace OT { 9 | namespace Layout { 10 | namespace GSUB_impl { 11 | 12 | struct ContextSubst : Context {}; 13 | 14 | } 15 | } 16 | } 17 | 18 | #endif /* OT_LAYOUT_GSUB_CONTEXTSUBST_HH */ 19 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/ExtensionSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_EXTENSIONSUBST_HH 2 | #define OT_LAYOUT_GSUB_EXTENSIONSUBST_HH 3 | 4 | // TODO(garretrieger): move to new layout. 5 | #include "../../../hb-ot-layout-gsubgpos.hh" 6 | #include "Common.hh" 7 | 8 | namespace OT { 9 | namespace Layout { 10 | namespace GSUB_impl { 11 | 12 | struct ExtensionSubst : Extension 13 | { 14 | typedef struct SubstLookupSubTable SubTable; 15 | bool is_reverse () const; 16 | }; 17 | 18 | } 19 | } 20 | } 21 | 22 | #endif /* OT_LAYOUT_GSUB_EXTENSIONSUBST_HH */ 23 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/GSUB.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_GSUB_HH 2 | #define OT_LAYOUT_GSUB_GSUB_HH 3 | 4 | #include "../../../hb-ot-layout-gsubgpos.hh" 5 | #include "Common.hh" 6 | #include "SubstLookup.hh" 7 | 8 | namespace OT { 9 | 10 | using Layout::GSUB_impl::SubstLookup; 11 | 12 | namespace Layout { 13 | 14 | /* 15 | * GSUB -- Glyph Substitution 16 | * https://docs.microsoft.com/en-us/typography/opentype/spec/gsub 17 | */ 18 | 19 | struct GSUB : GSUBGPOS 20 | { 21 | using Lookup = SubstLookup; 22 | 23 | static constexpr hb_tag_t tableTag = HB_OT_TAG_GSUB; 24 | 25 | const SubstLookup& get_lookup (unsigned int i) const 26 | { return static_cast (GSUBGPOS::get_lookup (i)); } 27 | 28 | bool subset (hb_subset_context_t *c) const 29 | { 30 | hb_subset_layout_context_t l (c, tableTag); 31 | return GSUBGPOS::subset (&l); 32 | } 33 | 34 | bool sanitize (hb_sanitize_context_t *c) const 35 | { 36 | TRACE_SANITIZE (this); 37 | return_trace (GSUBGPOS::sanitize (c)); 38 | } 39 | 40 | HB_INTERNAL bool is_blocklisted (hb_blob_t *blob, 41 | hb_face_t *face) const; 42 | 43 | void closure_lookups (hb_face_t *face, 44 | const hb_set_t *glyphs, 45 | hb_set_t *lookup_indexes /* IN/OUT */) const 46 | { GSUBGPOS::closure_lookups (face, glyphs, lookup_indexes); } 47 | 48 | typedef GSUBGPOS::accelerator_t accelerator_t; 49 | }; 50 | 51 | 52 | } 53 | 54 | struct GSUB_accelerator_t : Layout::GSUB::accelerator_t { 55 | GSUB_accelerator_t (hb_face_t *face) : Layout::GSUB::accelerator_t (face) {} 56 | }; 57 | 58 | 59 | } 60 | 61 | #endif /* OT_LAYOUT_GSUB_GSUB_HH */ 62 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/MultipleSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_MULTIPLESUBST_HH 2 | #define OT_LAYOUT_GSUB_MULTIPLESUBST_HH 3 | 4 | #include "Common.hh" 5 | #include "MultipleSubstFormat1.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | struct MultipleSubst 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | MultipleSubstFormat1_2 format1; 17 | #ifndef HB_NO_BEYOND_64K 18 | MultipleSubstFormat1_2 format2; 19 | #endif 20 | } u; 21 | 22 | public: 23 | 24 | template 25 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 26 | { 27 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 28 | TRACE_DISPATCH (this, u.format); 29 | switch (u.format) { 30 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 31 | #ifndef HB_NO_BEYOND_64K 32 | case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); 33 | #endif 34 | default:return_trace (c->default_return_value ()); 35 | } 36 | } 37 | 38 | template 40 | bool serialize (hb_serialize_context_t *c, 41 | Iterator it) 42 | { 43 | TRACE_SERIALIZE (this); 44 | if (unlikely (!c->extend_min (u.format))) return_trace (false); 45 | unsigned int format = 1; 46 | u.format = format; 47 | switch (u.format) { 48 | case 1: return_trace (u.format1.serialize (c, it)); 49 | default:return_trace (false); 50 | } 51 | } 52 | 53 | /* TODO subset() should choose format. */ 54 | 55 | }; 56 | 57 | 58 | } 59 | } 60 | } 61 | 62 | #endif /* OT_LAYOUT_GSUB_MULTIPLESUBST_HH */ 63 | -------------------------------------------------------------------------------- /src/OT/Layout/GSUB/ReverseChainSingleSubst.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_LAYOUT_GSUB_REVERSECHAINSINGLESUBST_HH 2 | #define OT_LAYOUT_GSUB_REVERSECHAINSINGLESUBST_HH 3 | 4 | #include "Common.hh" 5 | #include "ReverseChainSingleSubstFormat1.hh" 6 | 7 | namespace OT { 8 | namespace Layout { 9 | namespace GSUB_impl { 10 | 11 | struct ReverseChainSingleSubst 12 | { 13 | protected: 14 | union { 15 | HBUINT16 format; /* Format identifier */ 16 | ReverseChainSingleSubstFormat1 format1; 17 | } u; 18 | 19 | public: 20 | template 21 | typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const 22 | { 23 | if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value (); 24 | TRACE_DISPATCH (this, u.format); 25 | switch (u.format) { 26 | case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); 27 | default:return_trace (c->default_return_value ()); 28 | } 29 | } 30 | }; 31 | 32 | } 33 | } 34 | } 35 | 36 | #endif /* HB_OT_LAYOUT_GSUB_REVERSECHAINSINGLESUBST_HH */ 37 | -------------------------------------------------------------------------------- /src/OT/glyf/GlyphHeader.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_GLYPHHEADER_HH 2 | #define OT_GLYF_GLYPHHEADER_HH 3 | 4 | 5 | #include "../../hb-open-type.hh" 6 | 7 | 8 | namespace OT { 9 | namespace glyf_impl { 10 | 11 | 12 | struct GlyphHeader 13 | { 14 | bool has_data () const { return numberOfContours; } 15 | 16 | template 17 | bool get_extents_without_var_scaled (hb_font_t *font, const accelerator_t &glyf_accelerator, 18 | hb_codepoint_t gid, hb_glyph_extents_t *extents) const 19 | { 20 | /* Undocumented rasterizer behavior: shift glyph to the left by (lsb - xMin), i.e., xMin = lsb */ 21 | /* extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax); */ 22 | int lsb = hb_min (xMin, xMax); 23 | (void) glyf_accelerator.hmtx->get_leading_bearing_without_var_unscaled (gid, &lsb); 24 | extents->x_bearing = lsb; 25 | extents->y_bearing = hb_max (yMin, yMax); 26 | extents->width = hb_max (xMin, xMax) - hb_min (xMin, xMax); 27 | extents->height = hb_min (yMin, yMax) - hb_max (yMin, yMax); 28 | 29 | font->scale_glyph_extents (extents); 30 | 31 | return true; 32 | } 33 | 34 | HBINT16 numberOfContours; 35 | /* If the number of contours is 36 | * greater than or equal to zero, 37 | * this is a simple glyph; if negative, 38 | * this is a composite glyph. */ 39 | FWORD xMin; /* Minimum x for coordinate data. */ 40 | FWORD yMin; /* Minimum y for coordinate data. */ 41 | FWORD xMax; /* Maximum x for coordinate data. */ 42 | FWORD yMax; /* Maximum y for coordinate data. */ 43 | public: 44 | DEFINE_SIZE_STATIC (10); 45 | }; 46 | 47 | 48 | } /* namespace glyf_impl */ 49 | } /* namespace OT */ 50 | 51 | 52 | #endif /* OT_GLYF_GLYPHHEADER_HH */ 53 | -------------------------------------------------------------------------------- /src/OT/glyf/composite-iter.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_COMPOSITE_ITER_HH 2 | #define OT_GLYF_COMPOSITE_ITER_HH 3 | 4 | 5 | #include "../../hb.hh" 6 | 7 | 8 | namespace OT { 9 | namespace glyf_impl { 10 | 11 | 12 | template 13 | struct composite_iter_tmpl : hb_iter_with_fallback_t, 14 | const CompositeGlyphRecord &> 15 | { 16 | typedef const CompositeGlyphRecord *__item_t__; 17 | composite_iter_tmpl (hb_bytes_t glyph_, __item_t__ current_) : 18 | glyph (glyph_), current (nullptr), current_size (0) 19 | { 20 | set_current (current_); 21 | } 22 | 23 | composite_iter_tmpl () : glyph (hb_bytes_t ()), current (nullptr), current_size (0) {} 24 | 25 | const CompositeGlyphRecord & __item__ () const { return *current; } 26 | bool __more__ () const { return current; } 27 | void __next__ () 28 | { 29 | if (!current->has_more ()) { current = nullptr; return; } 30 | 31 | set_current (&StructAtOffset (current, current_size)); 32 | } 33 | composite_iter_tmpl __end__ () const { return composite_iter_tmpl (); } 34 | bool operator != (const composite_iter_tmpl& o) const 35 | { return current != o.current; } 36 | 37 | 38 | void set_current (__item_t__ current_) 39 | { 40 | if (!glyph.check_range (current_, CompositeGlyphRecord::min_size)) 41 | { 42 | current = nullptr; 43 | current_size = 0; 44 | return; 45 | } 46 | unsigned size = current_->get_size (); 47 | if (!glyph.check_range (current_, size)) 48 | { 49 | current = nullptr; 50 | current_size = 0; 51 | return; 52 | } 53 | 54 | current = current_; 55 | current_size = size; 56 | } 57 | 58 | private: 59 | hb_bytes_t glyph; 60 | __item_t__ current; 61 | unsigned current_size; 62 | }; 63 | 64 | 65 | } /* namespace glyf_impl */ 66 | } /* namespace OT */ 67 | 68 | #endif /* OT_GLYF_COMPOSITE_ITER_HH */ 69 | -------------------------------------------------------------------------------- /src/OT/glyf/coord-setter.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_COORD_SETTER_HH 2 | #define OT_GLYF_COORD_SETTER_HH 3 | 4 | 5 | #include "../../hb.hh" 6 | 7 | 8 | namespace OT { 9 | namespace glyf_impl { 10 | 11 | 12 | struct coord_setter_t 13 | { 14 | coord_setter_t (hb_array_t coords) : 15 | coords (coords) {} 16 | 17 | int& operator [] (unsigned idx) 18 | { 19 | if (unlikely (idx >= HB_GLYF_VAR_COMPOSITE_MAX_AXES)) 20 | return Crap(int); 21 | if (coords.length < idx + 1) 22 | coords.resize (idx + 1); 23 | return coords[idx]; 24 | } 25 | 26 | hb_array_t get_coords () 27 | { return coords.as_array (); } 28 | 29 | hb_vector_t coords; 30 | }; 31 | 32 | 33 | } /* namespace glyf_impl */ 34 | } /* namespace OT */ 35 | 36 | #endif /* OT_GLYF_COORD_SETTER_HH */ 37 | -------------------------------------------------------------------------------- /src/OT/glyf/loca.hh: -------------------------------------------------------------------------------- 1 | #ifndef OT_GLYF_LOCA_HH 2 | #define OT_GLYF_LOCA_HH 3 | 4 | 5 | #include "../../hb-open-type.hh" 6 | 7 | 8 | namespace OT { 9 | 10 | 11 | /* 12 | * loca -- Index to Location 13 | * https://docs.microsoft.com/en-us/typography/opentype/spec/loca 14 | */ 15 | #define HB_OT_TAG_loca HB_TAG('l','o','c','a') 16 | 17 | struct loca 18 | { 19 | friend struct glyf; 20 | friend struct glyf_accelerator_t; 21 | 22 | static constexpr hb_tag_t tableTag = HB_OT_TAG_loca; 23 | 24 | bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const 25 | { 26 | TRACE_SANITIZE (this); 27 | return_trace (true); 28 | } 29 | 30 | protected: 31 | UnsizedArrayOf 32 | dataZ; /* Location data. */ 33 | public: 34 | DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always 35 | * check the size externally, allow Null() object of it by 36 | * defining it _MIN instead. */ 37 | }; 38 | 39 | 40 | } /* namespace OT */ 41 | 42 | 43 | #endif /* OT_GLYF_LOCA_HH */ 44 | -------------------------------------------------------------------------------- /src/addTable.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from fontTools.ttLib import TTFont 3 | from fontTools.ttLib.tables.DefaultTable import DefaultTable 4 | 5 | if len(sys.argv) == 1: 6 | print("usage: python addTable.py input.ttf output.ttf Wasm.bin") 7 | sys.exit(1) 8 | 9 | font = TTFont(sys.argv[1]) 10 | 11 | wasm_table = DefaultTable("Wasm") 12 | wasm_table.data = open(sys.argv[3], "rb").read() 13 | 14 | font["Wasm"] = wasm_table 15 | 16 | font.save(sys.argv[2]) 17 | -------------------------------------------------------------------------------- /src/failing-alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | int alloc_state = 0; 33 | 34 | __attribute__((no_sanitize("integer"))) 35 | static int fastrand () 36 | { 37 | if (!alloc_state) return 1; 38 | /* Based on https://software.intel.com/content/www/us/en/develop/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor.html */ 39 | alloc_state = (214013 * alloc_state + 2531011); 40 | return (alloc_state >> 16) & 0x7FFF; 41 | } 42 | 43 | void* hb_malloc_impl (size_t size) 44 | { 45 | return (fastrand () % 16) ? malloc (size) : NULL; 46 | } 47 | 48 | void* hb_calloc_impl (size_t nmemb, size_t size) 49 | { 50 | return (fastrand () % 16) ? calloc (nmemb, size) : NULL; 51 | } 52 | 53 | void* hb_realloc_impl (void *ptr, size_t size) 54 | { 55 | return (fastrand () % 16) ? realloc (ptr, size) : NULL; 56 | } 57 | 58 | void hb_free_impl (void *ptr) 59 | { 60 | return free (ptr); 61 | } 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /src/graph/gsubgpos-context.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Garret Rieger 25 | */ 26 | 27 | #include "graph.hh" 28 | #include "../hb-ot-layout-gsubgpos.hh" 29 | 30 | #ifndef GRAPH_GSUBGPOS_CONTEXT_HH 31 | #define GRAPH_GSUBGPOS_CONTEXT_HH 32 | 33 | namespace graph { 34 | 35 | struct Lookup; 36 | 37 | struct gsubgpos_graph_context_t 38 | { 39 | hb_tag_t table_tag; 40 | graph_t& graph; 41 | unsigned lookup_list_index; 42 | hb_hashmap_t lookups; 43 | 44 | 45 | HB_INTERNAL gsubgpos_graph_context_t (hb_tag_t table_tag_, 46 | graph_t& graph_); 47 | 48 | HB_INTERNAL unsigned create_node (unsigned size); 49 | 50 | bool add_buffer (char* buffer) 51 | { 52 | return graph.add_buffer (buffer); 53 | } 54 | 55 | private: 56 | HB_INTERNAL unsigned num_non_ext_subtables (); 57 | }; 58 | 59 | } 60 | 61 | #endif // GRAPH_GSUBGPOS_CONTEXT 62 | -------------------------------------------------------------------------------- /src/graph/split-helpers.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Garret Rieger 25 | */ 26 | 27 | #ifndef GRAPH_SPLIT_HELPERS_HH 28 | #define GRAPH_SPLIT_HELPERS_HH 29 | 30 | namespace graph { 31 | 32 | template 33 | HB_INTERNAL 34 | hb_vector_t actuate_subtable_split (Context& split_context, 35 | const hb_vector_t& split_points) 36 | { 37 | hb_vector_t new_objects; 38 | if (!split_points) 39 | return new_objects; 40 | 41 | for (unsigned i = 0; i < split_points.length; i++) 42 | { 43 | unsigned start = split_points[i]; 44 | unsigned end = (i < split_points.length - 1) 45 | ? split_points[i + 1] 46 | : split_context.original_count (); 47 | unsigned id = split_context.clone_range (start, end); 48 | 49 | if (id == (unsigned) -1) 50 | { 51 | new_objects.reset (); 52 | new_objects.allocated = -1; // mark error 53 | return new_objects; 54 | } 55 | new_objects.push (id); 56 | } 57 | 58 | if (!split_context.shrink (split_points[0])) 59 | { 60 | new_objects.reset (); 61 | new_objects.allocated = -1; // mark error 62 | } 63 | 64 | return new_objects; 65 | } 66 | 67 | } 68 | 69 | #endif // GRAPH_SPLIT_HELPERS_HH 70 | -------------------------------------------------------------------------------- /src/harfbuzz-subset.cc: -------------------------------------------------------------------------------- 1 | #include "graph/gsubgpos-context.cc" 2 | #include "hb-aat-layout.cc" 3 | #include "hb-aat-map.cc" 4 | #include "hb-blob.cc" 5 | #include "hb-buffer-serialize.cc" 6 | #include "hb-buffer-verify.cc" 7 | #include "hb-buffer.cc" 8 | #include "hb-common.cc" 9 | #include "hb-draw.cc" 10 | #include "hb-face-builder.cc" 11 | #include "hb-face.cc" 12 | #include "hb-fallback-shape.cc" 13 | #include "hb-font.cc" 14 | #include "hb-map.cc" 15 | #include "hb-number.cc" 16 | #include "hb-ot-cff1-table.cc" 17 | #include "hb-ot-cff2-table.cc" 18 | #include "hb-ot-color.cc" 19 | #include "hb-ot-face.cc" 20 | #include "hb-ot-font.cc" 21 | #include "hb-ot-layout.cc" 22 | #include "hb-ot-map.cc" 23 | #include "hb-ot-math.cc" 24 | #include "hb-ot-meta.cc" 25 | #include "hb-ot-metrics.cc" 26 | #include "hb-ot-name.cc" 27 | #include "hb-ot-shape-fallback.cc" 28 | #include "hb-ot-shape-normalize.cc" 29 | #include "hb-ot-shape.cc" 30 | #include "hb-ot-shaper-arabic.cc" 31 | #include "hb-ot-shaper-default.cc" 32 | #include "hb-ot-shaper-hangul.cc" 33 | #include "hb-ot-shaper-hebrew.cc" 34 | #include "hb-ot-shaper-indic-table.cc" 35 | #include "hb-ot-shaper-indic.cc" 36 | #include "hb-ot-shaper-khmer.cc" 37 | #include "hb-ot-shaper-myanmar.cc" 38 | #include "hb-ot-shaper-syllabic.cc" 39 | #include "hb-ot-shaper-thai.cc" 40 | #include "hb-ot-shaper-use.cc" 41 | #include "hb-ot-shaper-vowel-constraints.cc" 42 | #include "hb-ot-tag.cc" 43 | #include "hb-ot-var.cc" 44 | #include "hb-outline.cc" 45 | #include "hb-paint-extents.cc" 46 | #include "hb-paint.cc" 47 | #include "hb-set.cc" 48 | #include "hb-shape-plan.cc" 49 | #include "hb-shape.cc" 50 | #include "hb-shaper.cc" 51 | #include "hb-static.cc" 52 | #include "hb-style.cc" 53 | #include "hb-subset-cff-common.cc" 54 | #include "hb-subset-cff1.cc" 55 | #include "hb-subset-cff2.cc" 56 | #include "hb-subset-input.cc" 57 | #include "hb-subset-instancer-solver.cc" 58 | #include "hb-subset-plan.cc" 59 | #include "hb-subset-repacker.cc" 60 | #include "hb-subset.cc" 61 | #include "hb-ucd.cc" 62 | #include "hb-unicode.cc" 63 | -------------------------------------------------------------------------------- /src/harfbuzz.cc: -------------------------------------------------------------------------------- 1 | #include "hb-aat-layout.cc" 2 | #include "hb-aat-map.cc" 3 | #include "hb-blob.cc" 4 | #include "hb-buffer-serialize.cc" 5 | #include "hb-buffer-verify.cc" 6 | #include "hb-buffer.cc" 7 | #include "hb-common.cc" 8 | #include "hb-coretext.cc" 9 | #include "hb-directwrite.cc" 10 | #include "hb-draw.cc" 11 | #include "hb-face-builder.cc" 12 | #include "hb-face.cc" 13 | #include "hb-fallback-shape.cc" 14 | #include "hb-font.cc" 15 | #include "hb-ft.cc" 16 | #include "hb-gdi.cc" 17 | #include "hb-glib.cc" 18 | #include "hb-graphite2.cc" 19 | #include "hb-map.cc" 20 | #include "hb-number.cc" 21 | #include "hb-ot-cff1-table.cc" 22 | #include "hb-ot-cff2-table.cc" 23 | #include "hb-ot-color.cc" 24 | #include "hb-ot-face.cc" 25 | #include "hb-ot-font.cc" 26 | #include "hb-ot-layout.cc" 27 | #include "hb-ot-map.cc" 28 | #include "hb-ot-math.cc" 29 | #include "hb-ot-meta.cc" 30 | #include "hb-ot-metrics.cc" 31 | #include "hb-ot-name.cc" 32 | #include "hb-ot-shape-fallback.cc" 33 | #include "hb-ot-shape-normalize.cc" 34 | #include "hb-ot-shape.cc" 35 | #include "hb-ot-shaper-arabic.cc" 36 | #include "hb-ot-shaper-default.cc" 37 | #include "hb-ot-shaper-hangul.cc" 38 | #include "hb-ot-shaper-hebrew.cc" 39 | #include "hb-ot-shaper-indic-table.cc" 40 | #include "hb-ot-shaper-indic.cc" 41 | #include "hb-ot-shaper-khmer.cc" 42 | #include "hb-ot-shaper-myanmar.cc" 43 | #include "hb-ot-shaper-syllabic.cc" 44 | #include "hb-ot-shaper-thai.cc" 45 | #include "hb-ot-shaper-use.cc" 46 | #include "hb-ot-shaper-vowel-constraints.cc" 47 | #include "hb-ot-tag.cc" 48 | #include "hb-ot-var.cc" 49 | #include "hb-outline.cc" 50 | #include "hb-paint-extents.cc" 51 | #include "hb-paint.cc" 52 | #include "hb-set.cc" 53 | #include "hb-shape-plan.cc" 54 | #include "hb-shape.cc" 55 | #include "hb-shaper.cc" 56 | #include "hb-static.cc" 57 | #include "hb-style.cc" 58 | #include "hb-ucd.cc" 59 | #include "hb-unicode.cc" 60 | #include "hb-uniscribe.cc" 61 | #include "hb-wasm-api.cc" 62 | #include "hb-wasm-shape.cc" 63 | -------------------------------------------------------------------------------- /src/hb-aat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_AAT_H 26 | #define HB_AAT_H 27 | #define HB_AAT_H_IN 28 | 29 | #include "hb.h" 30 | 31 | #include "hb-aat-layout.h" 32 | 33 | HB_BEGIN_DECLS 34 | 35 | HB_END_DECLS 36 | 37 | #undef HB_AAT_H_IN 38 | #endif /* HB_AAT_H */ 39 | -------------------------------------------------------------------------------- /src/hb-directwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015-2019 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_DIRECTWRITE_H 26 | #define HB_DIRECTWRITE_H 27 | 28 | #include "hb.h" 29 | 30 | HB_BEGIN_DECLS 31 | 32 | HB_EXTERN hb_face_t * 33 | hb_directwrite_face_create (IDWriteFontFace *font_face); 34 | 35 | HB_EXTERN IDWriteFontFace * 36 | hb_directwrite_face_get_font_face (hb_face_t *face); 37 | 38 | HB_END_DECLS 39 | 40 | #endif /* HB_DIRECTWRITE_H */ 41 | -------------------------------------------------------------------------------- /src/hb-gdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_GDI_H 26 | #define HB_GDI_H 27 | 28 | #include "hb.h" 29 | 30 | #include 31 | 32 | HB_BEGIN_DECLS 33 | 34 | HB_EXTERN hb_face_t * 35 | hb_gdi_face_create (HFONT hfont); 36 | 37 | HB_END_DECLS 38 | 39 | #endif /* HB_GDI_H */ 40 | -------------------------------------------------------------------------------- /src/hb-glib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * Copyright © 2011 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Red Hat Author(s): Behdad Esfahbod 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_GLIB_H 30 | #define HB_GLIB_H 31 | 32 | #include "hb.h" 33 | 34 | #include 35 | 36 | HB_BEGIN_DECLS 37 | 38 | 39 | HB_EXTERN hb_script_t 40 | hb_glib_script_to_script (GUnicodeScript script); 41 | 42 | HB_EXTERN GUnicodeScript 43 | hb_glib_script_from_script (hb_script_t script); 44 | 45 | 46 | HB_EXTERN hb_unicode_funcs_t * 47 | hb_glib_get_unicode_funcs (void); 48 | 49 | #if GLIB_CHECK_VERSION(2,31,10) 50 | HB_EXTERN hb_blob_t * 51 | hb_glib_blob_create (GBytes *gbytes); 52 | #endif 53 | 54 | HB_END_DECLS 55 | 56 | #endif /* HB_GLIB_H */ 57 | -------------------------------------------------------------------------------- /src/hb-gobject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_GOBJECT_H 28 | #define HB_GOBJECT_H 29 | #define HB_GOBJECT_H_IN 30 | 31 | #include "hb.h" 32 | 33 | #include "hb-gobject-enums.h" 34 | #include "hb-gobject-structs.h" 35 | 36 | HB_BEGIN_DECLS 37 | HB_END_DECLS 38 | 39 | #undef HB_GOBJECT_H_IN 40 | #endif /* HB_GOBJECT_H */ 41 | -------------------------------------------------------------------------------- /src/hb-graphite2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Martin Hosken 3 | * Copyright © 2011 SIL International 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | */ 25 | 26 | #ifndef HB_GRAPHITE2_H 27 | #define HB_GRAPHITE2_H 28 | 29 | #include "hb.h" 30 | 31 | #include 32 | 33 | HB_BEGIN_DECLS 34 | 35 | /** 36 | * HB_GRAPHITE2_TAG_SILF: 37 | * 38 | * The #hb_tag_t tag for the `Silf` table, which holds Graphite 39 | * features. 40 | * 41 | * For more information, see http://graphite.sil.org/ 42 | * 43 | **/ 44 | #define HB_GRAPHITE2_TAG_SILF HB_TAG('S','i','l','f') 45 | 46 | 47 | HB_EXTERN gr_face * 48 | hb_graphite2_face_get_gr_face (hb_face_t *face); 49 | 50 | #ifndef HB_DISABLE_DEPRECATED 51 | 52 | HB_DEPRECATED_FOR (hb_graphite2_face_get_gr_face) 53 | HB_EXTERN gr_font * 54 | hb_graphite2_font_get_gr_font (hb_font_t *font); 55 | 56 | #endif 57 | 58 | 59 | HB_END_DECLS 60 | 61 | #endif /* HB_GRAPHITE2_H */ 62 | -------------------------------------------------------------------------------- /src/hb-icu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * Copyright © 2011 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Red Hat Author(s): Behdad Esfahbod 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_ICU_H 30 | #define HB_ICU_H 31 | 32 | #include "hb.h" 33 | 34 | #include 35 | 36 | HB_BEGIN_DECLS 37 | 38 | 39 | HB_EXTERN hb_script_t 40 | hb_icu_script_to_script (UScriptCode script); 41 | 42 | HB_EXTERN UScriptCode 43 | hb_icu_script_from_script (hb_script_t script); 44 | 45 | 46 | HB_EXTERN hb_unicode_funcs_t * 47 | hb_icu_get_unicode_funcs (void); 48 | 49 | 50 | HB_END_DECLS 51 | 52 | #endif /* HB_ICU_H */ 53 | -------------------------------------------------------------------------------- /src/hb-number.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | */ 25 | 26 | #ifndef HB_NUMBER_HH 27 | #define HB_NUMBER_HH 28 | 29 | HB_INTERNAL bool 30 | hb_parse_int (const char **pp, const char *end, int *pv, 31 | bool whole_buffer = false); 32 | 33 | HB_INTERNAL bool 34 | hb_parse_uint (const char **pp, const char *end, unsigned int *pv, 35 | bool whole_buffer = false, int base = 10); 36 | 37 | HB_INTERNAL bool 38 | hb_parse_double (const char **pp, const char *end, double *pv, 39 | bool whole_buffer = false); 40 | 41 | #endif /* HB_NUMBER_HH */ 42 | -------------------------------------------------------------------------------- /src/hb-ot-face.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #include "hb-ot-face.hh" 28 | 29 | #include "hb-ot-cmap-table.hh" 30 | #include "hb-ot-glyf-table.hh" 31 | #include "hb-ot-cff1-table.hh" 32 | #include "hb-ot-cff2-table.hh" 33 | #include "hb-ot-hmtx-table.hh" 34 | #include "hb-ot-kern-table.hh" 35 | #include "hb-ot-meta-table.hh" 36 | #include "hb-ot-name-table.hh" 37 | #include "hb-ot-post-table.hh" 38 | #include "OT/Color/CBDT/CBDT.hh" 39 | #include "OT/Color/sbix/sbix.hh" 40 | #include "OT/Color/svg/svg.hh" 41 | #include "hb-ot-layout-gdef-table.hh" 42 | #include "hb-ot-layout-gsub-table.hh" 43 | #include "hb-ot-layout-gpos-table.hh" 44 | 45 | 46 | void hb_ot_face_t::init0 (hb_face_t *face) 47 | { 48 | this->face = face; 49 | #define HB_OT_TABLE(Namespace, Type) Type.init0 (); 50 | #include "hb-ot-face-table-list.hh" 51 | #undef HB_OT_TABLE 52 | } 53 | void hb_ot_face_t::fini () 54 | { 55 | #define HB_OT_TABLE(Namespace, Type) Type.fini (); 56 | #include "hb-ot-face-table-list.hh" 57 | #undef HB_OT_TABLE 58 | } 59 | -------------------------------------------------------------------------------- /src/hb-ot-font.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod, Roozbeh Pournader 25 | */ 26 | 27 | #if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) 28 | #error "Include instead." 29 | #endif 30 | 31 | #ifndef HB_OT_FONT_H 32 | #define HB_OT_FONT_H 33 | 34 | #include "hb.h" 35 | 36 | HB_BEGIN_DECLS 37 | 38 | 39 | HB_EXTERN void 40 | hb_ot_font_set_funcs (hb_font_t *font); 41 | 42 | 43 | HB_END_DECLS 44 | 45 | #endif /* HB_OT_FONT_H */ 46 | -------------------------------------------------------------------------------- /src/hb-ot-glyf-table.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Google, Inc. 3 | * Copyright © 2019 Adobe Inc. 4 | * Copyright © 2019 Ebrahim Byagowi 5 | * 6 | * This is part of HarfBuzz, a text shaping library. 7 | * 8 | * Permission is hereby granted, without written agreement and without 9 | * license or royalty fees, to use, copy, modify, and distribute this 10 | * software and its documentation for any purpose, provided that the 11 | * above copyright notice and the following two paragraphs appear in 12 | * all copies of this software. 13 | * 14 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 15 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 17 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 18 | * DAMAGE. 19 | * 20 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 21 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 23 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 24 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 25 | * 26 | * Google Author(s): Behdad Esfahbod, Garret Rieger, Roderick Sheeter 27 | * Adobe Author(s): Michiharu Ariza 28 | */ 29 | 30 | #ifndef HB_OT_GLYF_TABLE_HH 31 | #define HB_OT_GLYF_TABLE_HH 32 | 33 | #include "OT/glyf/glyf.hh" 34 | 35 | #endif /* HB_OT_GLYF_TABLE_HH */ 36 | -------------------------------------------------------------------------------- /src/hb-ot-layout-gdef-table.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2007,2008,2009 Red Hat, Inc. 3 | * Copyright © 2010,2011,2012 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Red Hat Author(s): Behdad Esfahbod 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_OT_LAYOUT_GDEF_TABLE_HH 30 | #define HB_OT_LAYOUT_GDEF_TABLE_HH 31 | 32 | #include "OT/Layout/GDEF/GDEF.hh" 33 | 34 | #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ 35 | -------------------------------------------------------------------------------- /src/hb-ot-metrics.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Ebrahim Byagowi 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_OT_METRICS_HH 26 | #define HB_OT_METRICS_HH 27 | 28 | #include "hb.hh" 29 | 30 | HB_INTERNAL bool 31 | _hb_ot_metrics_get_position_common (hb_font_t *font, 32 | hb_ot_metrics_tag_t metrics_tag, 33 | hb_position_t *position /* OUT. May be NULL. */); 34 | 35 | #endif /* HB_OT_METRICS_HH */ 36 | -------------------------------------------------------------------------------- /src/hb-ot-name-language.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_NAME_LANGUAGE_HH 28 | #define HB_OT_NAME_LANGUAGE_HH 29 | 30 | #include "hb.hh" 31 | 32 | 33 | HB_INTERNAL hb_language_t 34 | _hb_ot_name_language_for_ms_code (unsigned int code); 35 | 36 | HB_INTERNAL hb_language_t 37 | _hb_ot_name_language_for_mac_code (unsigned int code); 38 | 39 | 40 | #endif /* HB_OT_NAME_LANGUAGE_HH */ 41 | -------------------------------------------------------------------------------- /src/hb-ot-name-table.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011,2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_NAME_TABLE_HH 28 | #define HB_OT_NAME_TABLE_HH 29 | 30 | #include "OT/name/name.hh" 31 | 32 | #endif /* HB_OT_NAME_TABLE_HH */ 33 | -------------------------------------------------------------------------------- /src/hb-ot-shape-fallback.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_SHAPE_FALLBACK_HH 28 | #define HB_OT_SHAPE_FALLBACK_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-ot-shape.hh" 33 | 34 | 35 | HB_INTERNAL void _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, 36 | hb_font_t *font, 37 | hb_buffer_t *buffer, 38 | bool adjust_offsets_when_zeroing); 39 | 40 | HB_INTERNAL void _hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t *plan, 41 | hb_font_t *font, 42 | hb_buffer_t *buffer); 43 | 44 | 45 | HB_INTERNAL void _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, 46 | hb_font_t *font, 47 | hb_buffer_t *buffer); 48 | 49 | HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan, 50 | hb_font_t *font, 51 | hb_buffer_t *buffer); 52 | 53 | 54 | #endif /* HB_OT_SHAPE_FALLBACK_HH */ 55 | -------------------------------------------------------------------------------- /src/hb-ot-shape.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2013 Red Hat, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Red Hat Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) 28 | #error "Include instead." 29 | #endif 30 | 31 | #ifndef HB_OT_SHAPE_H 32 | #define HB_OT_SHAPE_H 33 | 34 | #include "hb.h" 35 | 36 | HB_BEGIN_DECLS 37 | 38 | /* TODO port to shape-plan / set. */ 39 | HB_EXTERN void 40 | hb_ot_shape_glyphs_closure (hb_font_t *font, 41 | hb_buffer_t *buffer, 42 | const hb_feature_t *features, 43 | unsigned int num_features, 44 | hb_set_t *glyphs); 45 | 46 | HB_EXTERN void 47 | hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan, 48 | hb_tag_t table_tag, 49 | hb_set_t *lookup_indexes /* OUT */); 50 | 51 | HB_END_DECLS 52 | 53 | #endif /* HB_OT_SHAPE_H */ 54 | -------------------------------------------------------------------------------- /src/hb-ot-shaper-arabic-joining-list.hh: -------------------------------------------------------------------------------- 1 | /* == Start of generated function == */ 2 | /* 3 | * The following function is generated by running: 4 | * 5 | * ./gen-arabic-joining-list.py ArabicShaping.txt Scripts.txt 6 | * 7 | * on files with these headers: 8 | * 9 | * # ArabicShaping-15.0.0.txt 10 | * # Date: 2022-02-14, 18:50:00 GMT [KW, RP] 11 | * # Scripts-15.0.0.txt 12 | * # Date: 2022-04-26, 23:15:02 GMT 13 | */ 14 | 15 | #ifndef HB_OT_SHAPER_ARABIC_JOINING_LIST_HH 16 | #define HB_OT_SHAPER_ARABIC_JOINING_LIST_HH 17 | 18 | static bool 19 | has_arabic_joining (hb_script_t script) 20 | { 21 | /* List of scripts that have data in arabic-table. */ 22 | switch ((int) script) 23 | { 24 | case HB_SCRIPT_ADLAM: 25 | case HB_SCRIPT_ARABIC: 26 | case HB_SCRIPT_CHORASMIAN: 27 | case HB_SCRIPT_HANIFI_ROHINGYA: 28 | case HB_SCRIPT_MANDAIC: 29 | case HB_SCRIPT_MANICHAEAN: 30 | case HB_SCRIPT_MONGOLIAN: 31 | case HB_SCRIPT_NKO: 32 | case HB_SCRIPT_OLD_UYGHUR: 33 | case HB_SCRIPT_PHAGS_PA: 34 | case HB_SCRIPT_PSALTER_PAHLAVI: 35 | case HB_SCRIPT_SOGDIAN: 36 | case HB_SCRIPT_SYRIAC: 37 | return true; 38 | 39 | default: 40 | return false; 41 | } 42 | } 43 | 44 | 45 | #endif /* HB_OT_SHAPER_ARABIC_JOINING_LIST_HH */ 46 | 47 | /* == End of generated function == */ 48 | -------------------------------------------------------------------------------- /src/hb-ot-shaper-arabic.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Mozilla Foundation. 3 | * Copyright © 2015 Google, Inc. 4 | * 5 | * This is part of HarfBuzz, a text shaping library. 6 | * 7 | * Permission is hereby granted, without written agreement and without 8 | * license or royalty fees, to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose, provided that the 10 | * above copyright notice and the following two paragraphs appear in 11 | * all copies of this software. 12 | * 13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 17 | * DAMAGE. 18 | * 19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 24 | * 25 | * Mozilla Author(s): Jonathan Kew 26 | * Google Author(s): Behdad Esfahbod 27 | */ 28 | 29 | #ifndef HB_OT_SHAPER_ARABIC_HH 30 | #define HB_OT_SHAPER_ARABIC_HH 31 | 32 | #include "hb.hh" 33 | 34 | #include "hb-ot-shaper.hh" 35 | 36 | 37 | struct arabic_shape_plan_t; 38 | 39 | HB_INTERNAL void * 40 | data_create_arabic (const hb_ot_shape_plan_t *plan); 41 | 42 | HB_INTERNAL void 43 | data_destroy_arabic (void *data); 44 | 45 | HB_INTERNAL void 46 | setup_masks_arabic_plan (const arabic_shape_plan_t *arabic_plan, 47 | hb_buffer_t *buffer, 48 | hb_script_t script); 49 | 50 | #endif /* HB_OT_SHAPER_ARABIC_HH */ 51 | -------------------------------------------------------------------------------- /src/hb-ot-shaper-indic.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_SHAPER_INDIC_HH 28 | #define HB_OT_SHAPER_INDIC_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-ot-shaper-syllabic.hh" 33 | 34 | 35 | /* Visual positions in a syllable from left to right. */ 36 | enum ot_position_t { 37 | POS_START = 0, 38 | 39 | POS_RA_TO_BECOME_REPH = 1, 40 | POS_PRE_M = 2, 41 | POS_PRE_C = 3, 42 | 43 | POS_BASE_C = 4, 44 | POS_AFTER_MAIN = 5, 45 | 46 | POS_ABOVE_C = 6, 47 | 48 | POS_BEFORE_SUB = 7, 49 | POS_BELOW_C = 8, 50 | POS_AFTER_SUB = 9, 51 | 52 | POS_BEFORE_POST = 10, 53 | POS_POST_C = 11, 54 | POS_AFTER_POST = 12, 55 | 56 | POS_SMVD = 13, 57 | 58 | POS_END = 14 59 | }; 60 | 61 | 62 | HB_INTERNAL uint16_t 63 | hb_indic_get_categories (hb_codepoint_t u); 64 | 65 | 66 | #endif /* HB_OT_SHAPER_INDIC_HH */ 67 | -------------------------------------------------------------------------------- /src/hb-ot-shaper-syllabic.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2021 Behdad Esfahbod. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_OT_SHAPER_SYLLABIC_HH 26 | #define HB_OT_SHAPER_SYLLABIC_HH 27 | 28 | #include "hb.hh" 29 | 30 | #include "hb-ot-shaper.hh" 31 | 32 | 33 | HB_INTERNAL bool 34 | hb_syllabic_insert_dotted_circles (hb_font_t *font, 35 | hb_buffer_t *buffer, 36 | unsigned int broken_syllable_type, 37 | unsigned int dottedcircle_category, 38 | int repha_category = -1, 39 | int dottedcircle_position = -1); 40 | 41 | HB_INTERNAL bool 42 | hb_syllabic_clear_var (const hb_ot_shape_plan_t *plan, 43 | hb_font_t *font, 44 | hb_buffer_t *buffer); 45 | 46 | 47 | #endif /* HB_OT_SHAPER_SYLLABIC_HH */ 48 | -------------------------------------------------------------------------------- /src/hb-ot-shaper-vowel-constraints.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_SHAPER_VOWEL_CONSTRAINTS_HH 28 | #define HB_OT_SHAPER_VOWEL_CONSTRAINTS_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-ot-shaper.hh" 33 | 34 | HB_INTERNAL void 35 | _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan, 36 | hb_buffer_t *buffer, 37 | hb_font_t *font); 38 | 39 | #endif /* HB_OT_SHAPER_VOWEL_CONSTRAINTS_HH */ 40 | -------------------------------------------------------------------------------- /src/hb-ot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Red Hat Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_OT_H 28 | #define HB_OT_H 29 | #define HB_OT_H_IN 30 | 31 | #include "hb.h" 32 | 33 | #include "hb-ot-color.h" 34 | #include "hb-ot-deprecated.h" 35 | #include "hb-ot-font.h" 36 | #include "hb-ot-layout.h" 37 | #include "hb-ot-math.h" 38 | #include "hb-ot-meta.h" 39 | #include "hb-ot-metrics.h" 40 | #include "hb-ot-name.h" 41 | #include "hb-ot-shape.h" 42 | #include "hb-ot-var.h" 43 | 44 | HB_BEGIN_DECLS 45 | 46 | HB_END_DECLS 47 | 48 | #undef HB_OT_H_IN 49 | #endif /* HB_OT_H */ 50 | -------------------------------------------------------------------------------- /src/hb-outline.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_OUTLINE_HH 26 | #define HB_OUTLINE_HH 27 | 28 | #include "hb.hh" 29 | 30 | #include "hb-draw.hh" 31 | 32 | 33 | struct hb_outline_point_t 34 | { 35 | enum class type_t 36 | { 37 | MOVE_TO, 38 | LINE_TO, 39 | QUADRATIC_TO, 40 | CUBIC_TO, 41 | }; 42 | 43 | hb_outline_point_t (float x, float y, type_t type) : 44 | x (x), y (y), type (type) {} 45 | 46 | float x, y; 47 | type_t type; 48 | }; 49 | 50 | struct hb_outline_vector_t 51 | { 52 | float normalize_len () 53 | { 54 | float len = hypotf (x, y); 55 | if (len) 56 | { 57 | x /= len; 58 | y /= len; 59 | } 60 | return len; 61 | } 62 | 63 | float x, y; 64 | }; 65 | 66 | struct hb_outline_t 67 | { 68 | void reset () { points.shrink (0, false); contours.resize (0); } 69 | 70 | HB_INTERNAL void replay (hb_draw_funcs_t *pen, void *pen_data) const; 71 | HB_INTERNAL float control_area () const; 72 | HB_INTERNAL void embolden (float x_strength, float y_strength, 73 | float x_shift, float y_shift); 74 | 75 | hb_vector_t points; 76 | hb_vector_t contours; 77 | }; 78 | 79 | HB_INTERNAL hb_draw_funcs_t * 80 | hb_outline_recording_pen_get_funcs (); 81 | 82 | 83 | #endif /* HB_OUTLINE_HH */ 84 | -------------------------------------------------------------------------------- /src/hb-shaper-impl.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_SHAPER_IMPL_HH 28 | #define HB_SHAPER_IMPL_HH 29 | 30 | #include "hb.hh" 31 | 32 | #include "hb-shaper.hh" 33 | #include "hb-face.hh" 34 | #include "hb-font.hh" 35 | #include "hb-shape-plan.hh" 36 | #include "hb-buffer.hh" 37 | 38 | #endif /* HB_SHAPER_IMPL_HH */ 39 | -------------------------------------------------------------------------------- /src/hb-shaper-list.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_SHAPER_LIST_HH 28 | #define HB_SHAPER_LIST_HH 29 | #endif /* HB_SHAPER_LIST_HH */ /* Dummy header guards */ 30 | 31 | #ifndef HB_NO_SHAPER 32 | 33 | 34 | /* v--- Add new shapers in the right place here. */ 35 | 36 | #ifdef HAVE_WASM 37 | /* Only picks up fonts that have a "Wasm" table. */ 38 | HB_SHAPER_IMPLEMENT (wasm) 39 | #endif 40 | 41 | #ifdef HAVE_GRAPHITE2 42 | /* Only picks up fonts that have a "Silf" table. */ 43 | HB_SHAPER_IMPLEMENT (graphite2) 44 | #endif 45 | 46 | #ifndef HB_NO_OT_SHAPE 47 | HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main shaper. */ 48 | #endif 49 | 50 | #ifdef HAVE_UNISCRIBE 51 | HB_SHAPER_IMPLEMENT (uniscribe) 52 | #endif 53 | #ifdef HAVE_DIRECTWRITE 54 | HB_SHAPER_IMPLEMENT (directwrite) 55 | #endif 56 | #ifdef HAVE_CORETEXT 57 | HB_SHAPER_IMPLEMENT (coretext) 58 | #endif 59 | 60 | #ifndef HB_NO_FALLBACK_SHAPE 61 | HB_SHAPER_IMPLEMENT (fallback) /* <--- This should be last. */ 62 | #endif 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/hb-uniscribe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_UNISCRIBE_H 28 | #define HB_UNISCRIBE_H 29 | 30 | #include "hb.h" 31 | 32 | #include 33 | 34 | HB_BEGIN_DECLS 35 | 36 | 37 | HB_EXTERN LOGFONTW * 38 | hb_uniscribe_font_get_logfontw (hb_font_t *font); 39 | 40 | HB_EXTERN HFONT 41 | hb_uniscribe_font_get_hfont (hb_font_t *font); 42 | 43 | 44 | HB_END_DECLS 45 | 46 | #endif /* HB_UNISCRIBE_H */ 47 | -------------------------------------------------------------------------------- /src/hb-wasm-api-blob.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_WASM_API_BLOB_HH 26 | #define HB_WASM_API_BLOB_HH 27 | 28 | #include "hb-wasm-api.hh" 29 | 30 | namespace hb { 31 | namespace wasm { 32 | 33 | 34 | HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV 35 | ptr_d(blob_t, blob)) 36 | { 37 | HB_PTR_PARAM (blob_t, blob); 38 | if (unlikely (!blob)) 39 | return; 40 | 41 | module_free (blob->data); 42 | 43 | blob->data = nullref; 44 | blob->length = 0; 45 | } 46 | 47 | 48 | }} 49 | 50 | #endif /* HB_WASM_API_BLOB_HH */ 51 | -------------------------------------------------------------------------------- /src/hb-wasm-api-common.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_WASM_API_COMMON_HH 26 | #define HB_WASM_API_COMMON_HH 27 | 28 | #include "hb-wasm-api.hh" 29 | 30 | namespace hb { 31 | namespace wasm { 32 | 33 | 34 | HB_WASM_API (direction_t, script_get_horizontal_direction) (HB_WASM_EXEC_ENV 35 | script_t script) 36 | { 37 | return (direction_t) 38 | hb_script_get_horizontal_direction (hb_script_from_iso15924_tag (script)); 39 | } 40 | 41 | 42 | }} 43 | 44 | #endif /* HB_WASM_API_COMMON_HH */ 45 | -------------------------------------------------------------------------------- /src/hb-wasm-api-shape.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #ifndef HB_WASM_API_SHAPE_HH 26 | #define HB_WASM_API_SHAPE_HH 27 | 28 | #include "hb-wasm-api.hh" 29 | 30 | namespace hb { 31 | namespace wasm { 32 | 33 | 34 | static_assert (sizeof (feature_t) == sizeof (hb_feature_t), ""); 35 | 36 | HB_WASM_INTERFACE (bool_t, shape_with) (HB_WASM_EXEC_ENV 37 | ptr_d(font_t, font), 38 | ptr_d(buffer_t, buffer), 39 | ptr_d(const feature_t, features), 40 | uint32_t num_features, 41 | const char *shaper) 42 | { 43 | if (unlikely (0 == strcmp (shaper, "wasm"))) 44 | return false; 45 | 46 | HB_REF2OBJ (font); 47 | HB_REF2OBJ (buffer); 48 | 49 | /* Pre-conditions that make hb_shape_full() crash should be checked here. */ 50 | 51 | if (unlikely (!buffer->ensure_unicode ())) 52 | return false; 53 | 54 | if (unlikely (!HB_DIRECTION_IS_VALID (buffer->props.direction))) 55 | return false; 56 | 57 | HB_ARRAY_PARAM (const feature_t, features, num_features); 58 | if (unlikely (!features && num_features)) 59 | return false; 60 | 61 | const char * shaper_list[] = {shaper, nullptr}; 62 | return hb_shape_full (font, buffer, 63 | (hb_feature_t *) features, num_features, 64 | shaper_list); 65 | } 66 | 67 | 68 | }} 69 | 70 | #endif /* HB_WASM_API_SHAPE_HH */ 71 | -------------------------------------------------------------------------------- /src/hb-wasm-api.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2023 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #include "hb.hh" 26 | 27 | #ifdef HAVE_WASM 28 | 29 | #include "hb-wasm-api.hh" 30 | 31 | #define module_inst wasm_runtime_get_module_inst (exec_env) 32 | 33 | 34 | #include "hb-wasm-api-blob.hh" 35 | #include "hb-wasm-api-buffer.hh" 36 | #include "hb-wasm-api-common.hh" 37 | #include "hb-wasm-api-face.hh" 38 | #include "hb-wasm-api-font.hh" 39 | #include "hb-wasm-api-shape.hh" 40 | 41 | 42 | #undef module_inst 43 | 44 | hb_user_data_key_t _hb_wasm_ref_type_key = {}; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/hb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Red Hat, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Red Hat Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #ifndef HB_H 28 | #define HB_H 29 | #define HB_H_IN 30 | 31 | #include "hb-blob.h" 32 | #include "hb-buffer.h" 33 | #include "hb-common.h" 34 | #include "hb-deprecated.h" 35 | #include "hb-draw.h" 36 | #include "hb-face.h" 37 | #include "hb-font.h" 38 | #include "hb-map.h" 39 | #include "hb-paint.h" 40 | #include "hb-set.h" 41 | #include "hb-shape.h" 42 | #include "hb-shape-plan.h" 43 | #include "hb-style.h" 44 | #include "hb-unicode.h" 45 | #include "hb-version.h" 46 | 47 | HB_BEGIN_DECLS 48 | HB_END_DECLS 49 | 50 | #undef HB_H_IN 51 | #endif /* HB_H */ 52 | -------------------------------------------------------------------------------- /src/test-gpos-size-params.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2010,2011 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #include "hb.hh" 28 | 29 | #include "hb.h" 30 | #include "hb-ot.h" 31 | 32 | #ifdef HB_NO_OPEN 33 | #define hb_blob_create_from_file_or_fail(x) hb_blob_get_empty () 34 | #endif 35 | 36 | int 37 | main (int argc, char **argv) 38 | { 39 | if (argc != 2) { 40 | fprintf (stderr, "usage: %s font-file\n", argv[0]); 41 | exit (1); 42 | } 43 | 44 | /* Create the face */ 45 | hb_blob_t *blob = hb_blob_create_from_file_or_fail (argv[1]); 46 | assert (blob); 47 | hb_face_t *face = hb_face_create (blob, 0 /* first face */); 48 | hb_blob_destroy (blob); 49 | blob = nullptr; 50 | 51 | bool ret = true; 52 | 53 | #ifndef HB_NO_LAYOUT_FEATURE_PARAMS 54 | unsigned int p[5]; 55 | ret = hb_ot_layout_get_size_params (face, p, p+1, (p+2), p+3, p+4); 56 | printf ("%g %u %u %g %g\n", p[0]/10., p[1], p[2], p[3]/10., p[4]/10.); 57 | #endif 58 | 59 | hb_face_destroy (face); 60 | 61 | return !ret; 62 | } 63 | -------------------------------------------------------------------------------- /src/test-gsub-would-substitute.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2010,2011 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #include "hb.hh" 28 | 29 | #include "hb.h" 30 | #include "hb-ot.h" 31 | 32 | #ifdef HAVE_FREETYPE 33 | #include "hb-ft.h" 34 | #endif 35 | 36 | #ifdef HB_NO_OPEN 37 | #define hb_blob_create_from_file_or_fail(x) hb_blob_get_empty () 38 | #endif 39 | 40 | int 41 | main (int argc, char **argv) 42 | { 43 | if (argc != 4 && argc != 5) { 44 | fprintf (stderr, "usage: %s font-file lookup-index first-glyph [second-glyph]\n", argv[0]); 45 | exit (1); 46 | } 47 | 48 | /* Create the face */ 49 | hb_blob_t *blob = hb_blob_create_from_file_or_fail (argv[1]); 50 | assert (blob); 51 | hb_face_t *face = hb_face_create (blob, 0 /* first face */); 52 | hb_blob_destroy (blob); 53 | blob = nullptr; 54 | 55 | hb_font_t *font = hb_font_create (face); 56 | #ifdef HAVE_FREETYPE 57 | hb_ft_font_set_funcs (font); 58 | #endif 59 | 60 | unsigned int len = argc - 3; 61 | hb_codepoint_t glyphs[2]; 62 | if (!hb_font_glyph_from_string (font, argv[3], -1, &glyphs[0]) || 63 | (argc > 4 && 64 | !hb_font_glyph_from_string (font, argv[4], -1, &glyphs[1]))) 65 | return 2; 66 | return !hb_ot_layout_lookup_would_substitute (face, strtol (argv[2], nullptr, 0), glyphs, len, false); 67 | } 68 | -------------------------------------------------------------------------------- /src/test-machinery.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #include "hb.hh" 26 | #include "hb-machinery.hh" 27 | 28 | struct hb_intp_lazy_loader_t : hb_lazy_loader_t 29 | { 30 | static int* create () { return nullptr; } 31 | static void destroy (int* l) {} 32 | static int* get_null () { return nullptr; } 33 | }; 34 | 35 | struct hb_void_lazy_loader_t : hb_lazy_loader_t 36 | { 37 | static void* create () { return nullptr; } 38 | static void destroy (void* l) {} 39 | static void* get_null () { return nullptr; } 40 | }; 41 | 42 | int 43 | main (int argc, char **argv) 44 | { 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /src/test-multimap.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | */ 24 | 25 | #include "hb.hh" 26 | #include "hb-multimap.hh" 27 | 28 | int 29 | main (int argc, char **argv) 30 | { 31 | hb_multimap_t m; 32 | 33 | assert (m.get (10).length == 0); 34 | 35 | m.add (10, 11); 36 | assert (m.get (10).length == 1); 37 | 38 | m.add (10, 12); 39 | assert (m.get (10).length == 2); 40 | 41 | m.add (10, 13); 42 | assert (m.get (10).length == 3); 43 | assert (m.get (10)[0] == 11); 44 | assert (m.get (10)[1] == 12); 45 | assert (m.get (10)[2] == 13); 46 | 47 | assert (m.get (11).length == 0); 48 | m.add (11, 14); 49 | assert (m.get (10).length == 3); 50 | assert (m.get (11).length == 1); 51 | assert (m.get (12).length == 0); 52 | assert (m.get (10)[0] == 11); 53 | assert (m.get (10)[1] == 12); 54 | assert (m.get (10)[2] == 13); 55 | assert (m.get (11)[0] == 14); 56 | assert (m.get (12)[0] == 0); // Array fallback value 57 | 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /src/test-ot-name.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Behdad Esfahbod 25 | */ 26 | 27 | #include "hb.hh" 28 | #include "hb-ot.h" 29 | 30 | #ifdef HB_NO_OPEN 31 | #define hb_blob_create_from_file_or_fail(x) hb_blob_get_empty () 32 | #endif 33 | 34 | int 35 | main (int argc, char **argv) 36 | { 37 | if (argc != 2) { 38 | fprintf (stderr, "usage: %s font-file\n", argv[0]); 39 | exit (1); 40 | } 41 | 42 | hb_blob_t *blob = hb_blob_create_from_file_or_fail (argv[1]); 43 | assert (blob); 44 | hb_face_t *face = hb_face_create (blob, 0 /* first face */); 45 | hb_blob_destroy (blob); 46 | blob = nullptr; 47 | 48 | unsigned int count = 0; 49 | 50 | #ifndef HB_NO_NAME 51 | const hb_ot_name_entry_t *entries = hb_ot_name_list_names (face, &count); 52 | 53 | for (unsigned int i = 0; i < count; i++) 54 | { 55 | printf ("%u %s ", 56 | entries[i].name_id, 57 | hb_language_to_string (entries[i].language)); 58 | 59 | char buf[64]; 60 | unsigned int buf_size = sizeof (buf); 61 | hb_ot_name_get_utf8 (face, 62 | entries[i].name_id, 63 | entries[i].language, 64 | &buf_size, 65 | buf); 66 | 67 | printf ("%s\n", buf); 68 | } 69 | #endif 70 | 71 | hb_face_destroy (face); 72 | 73 | return count ? 0 : 1; 74 | } 75 | -------------------------------------------------------------------------------- /src/test-serialize.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2022 Behdad Esfahbod 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | */ 25 | 26 | #include "hb.hh" 27 | #include "hb-serialize.hh" 28 | #include "hb-ot-layout-common.hh" 29 | 30 | using OT::Layout::Common::Coverage; 31 | 32 | int 33 | main (int argc, char **argv) 34 | { 35 | char buf[16384]; 36 | 37 | hb_serialize_context_t s (buf, sizeof (buf)); 38 | 39 | hb_sorted_vector_t v{1, 2, 5}; 40 | 41 | auto c = s.start_serialize (); 42 | 43 | c->serialize (&s, hb_iter (v)); 44 | 45 | s.end_serialize (); 46 | 47 | hb_bytes_t bytes = s.copy_bytes (); 48 | assert (bytes.length == 10); 49 | bytes.fini (); 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /src/test-unicode-ranges.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Google, Inc. 3 | * 4 | * This is part of HarfBuzz, a text shaping library. 5 | * 6 | * Permission is hereby granted, without written agreement and without 7 | * license or royalty fees, to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose, provided that the 9 | * above copyright notice and the following two paragraphs appear in 10 | * all copies of this software. 11 | * 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16 | * DAMAGE. 17 | * 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23 | * 24 | * Google Author(s): Garret Rieger 25 | */ 26 | 27 | #include "hb.hh" 28 | #include "hb-ot-os2-unicode-ranges.hh" 29 | 30 | static void 31 | test (hb_codepoint_t cp, unsigned int bit) 32 | { 33 | if (OT::_hb_ot_os2_get_unicode_range_bit (cp) != bit) 34 | { 35 | fprintf (stderr, "got incorrect bit (%u) for cp 0x%X. Should have been %u.", 36 | OT::_hb_ot_os2_get_unicode_range_bit (cp), 37 | cp, 38 | bit); 39 | abort(); 40 | } 41 | } 42 | 43 | static void 44 | test_get_unicode_range_bit () 45 | { 46 | test (0x0000, 0); 47 | test (0x0042, 0); 48 | test (0x007F, 0); 49 | test (0x0080, 1); 50 | 51 | test (0x30A0, 50); 52 | test (0x30B1, 50); 53 | test (0x30FF, 50); 54 | 55 | test (0x10FFFD, 90); 56 | 57 | test (0x30000, -1); 58 | test (0x110000, -1); 59 | } 60 | 61 | int 62 | main () 63 | { 64 | test_get_unicode_range_bit (); 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /src/test-use-table.cc: -------------------------------------------------------------------------------- 1 | #include "hb-ot-shaper-use-table.hh" 2 | 3 | int main (int argc, char **argv) 4 | { 5 | if (argc != 2) 6 | { 7 | for (unsigned u = 0; u < 0x10FFFFu; u++) 8 | printf ("U+%04X %d\n", u, hb_use_get_category (u)); 9 | return 0; 10 | } 11 | 12 | hb_codepoint_t u; 13 | sscanf (argv[1], "%x", &u); 14 | 15 | printf ("%d\n", hb_use_get_category (u)); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /src/wasm/rust/harfbuzz-wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "harfbuzz-wasm" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | kurbo = { version = "0.9.0", optional = true } 10 | -------------------------------------------------------------------------------- /src/wasm/sample/c/shape-fallback.cc: -------------------------------------------------------------------------------- 1 | #define HB_WASM_INTERFACE(ret_t, name) __attribute__((export_name(#name))) ret_t name 2 | 3 | #include 4 | 5 | extern "C" { 6 | void debugprint (const char *s); 7 | void debugprint1 (const char *s, int32_t); 8 | void debugprint2 (const char *s, int32_t, int32_t); 9 | } 10 | 11 | bool_t 12 | shape (void *shape_plan, 13 | font_t *font, 14 | buffer_t *buffer, 15 | const feature_t *features, 16 | uint32_t num_features) 17 | { 18 | face_t *face = font_get_face (font); 19 | 20 | blob_t blob = BLOB_INIT; 21 | face_copy_table (face, TAG ('c','m','a','p'), &blob); 22 | 23 | debugprint1 ("cmap length", blob.length); 24 | 25 | blob_free (&blob); 26 | 27 | buffer_contents_t contents = BUFFER_CONTENTS_INIT; 28 | if (!buffer_copy_contents (buffer, &contents)) 29 | return false; 30 | 31 | debugprint1 ("buffer length", contents.length); 32 | 33 | glyph_outline_t outline = GLYPH_OUTLINE_INIT; 34 | 35 | for (unsigned i = 0; i < contents.length; i++) 36 | { 37 | char name[64]; 38 | 39 | debugprint1 ("glyph at", i); 40 | 41 | font_glyph_to_string (font, contents.info[i].codepoint, name, sizeof (name)); 42 | 43 | debugprint (name); 44 | 45 | contents.info[i].codepoint = font_get_glyph (font, contents.info[i].codepoint, 0); 46 | contents.pos[i].x_advance = font_get_glyph_h_advance (font, contents.info[i].codepoint); 47 | 48 | font_copy_glyph_outline (font, contents.info[i].codepoint, &outline); 49 | debugprint1 ("num outline points", outline.n_points); 50 | debugprint1 ("num outline contours", outline.n_contours); 51 | } 52 | 53 | glyph_outline_free (&outline); 54 | 55 | bool_t ret = buffer_set_contents (buffer, &contents); 56 | 57 | buffer_contents_free (&contents); 58 | 59 | return ret; 60 | } 61 | -------------------------------------------------------------------------------- /src/wasm/sample/c/shape-ot.cc: -------------------------------------------------------------------------------- 1 | #define HB_WASM_INTERFACE(ret_t, name) __attribute__((export_name(#name))) ret_t name 2 | 3 | #include 4 | 5 | extern "C" { 6 | void debugprint1 (const char *s, int32_t); 7 | void debugprint2 (const char *s, int32_t, int32_t); 8 | } 9 | 10 | bool_t 11 | shape (void *shape_plan, 12 | font_t *font, 13 | buffer_t *buffer, 14 | const feature_t *features, 15 | uint32_t num_features) 16 | { 17 | return shape_with (font, buffer, features, num_features, "ot"); 18 | } 19 | -------------------------------------------------------------------------------- /src/wasm/sample/c/test.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hexops/harfbuzz/c514da98afcf5d9ad6854a7f09192f9ecfaeb061/src/wasm/sample/c/test.ttf -------------------------------------------------------------------------------- /src/wasm/sample/rust/hello-wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello-wasm" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | #externref = "0.1.0" 11 | wasm-bindgen = "0.2.0" 12 | tiny-rng = "0.2.0" 13 | harfbuzz-wasm = { path="../../../rust/harfbuzz-wasm"} 14 | -------------------------------------------------------------------------------- /src/wasm/sample/rust/hello-wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | use harfbuzz_wasm::{Font, GlyphBuffer}; 2 | use tiny_rng::{Rand, Rng}; 3 | use wasm_bindgen::prelude::*; 4 | 5 | #[wasm_bindgen] 6 | pub fn shape( 7 | _shape_plan: u32, 8 | font_ref: u32, 9 | buf_ref: u32, 10 | _features: u32, 11 | _num_features: u32, 12 | ) -> i32 { 13 | let mut rng = Rng::from_seed(123456); 14 | let font = Font::from_ref(font_ref); 15 | font.shape_with(buf_ref, "ot"); 16 | let mut buffer = GlyphBuffer::from_ref(buf_ref); 17 | for mut item in buffer.glyphs.iter_mut() { 18 | // Randomize it! 19 | item.x_offset = ((rng.rand_u32() as i32) >> 24) - 120; 20 | item.y_offset = ((rng.rand_u32() as i32) >> 24) - 120; 21 | } 22 | // Buffer is written back to HB on drop 23 | 1 24 | } 25 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | git remote add upstream https://github.com/harfbuzz/harfbuzz || true 5 | git fetch upstream 6 | git merge upstream/main || true 7 | git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm 8 | -------------------------------------------------------------------------------- /verify.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | git diff $(git merge-base main upstream/main)..main \ 5 | --diff-filter=d \ 6 | ':(exclude)README.md' \ 7 | ':(exclude)build.zig' \ 8 | ':(exclude)build.zig.zon' \ 9 | ':(exclude)update.sh' \ 10 | ':(exclude)verify.sh' \ 11 | ':(exclude).github' \ 12 | ':(exclude).gitignore' 13 | --------------------------------------------------------------------------------