/libre/icecat/harfbuzz-1.1.3.patch
Patch | 1853 lines | 1746 code | 107 blank | 0 comment | 0 complexity | 7bef6d5da4ec26cc3170f5095cc94458 MD5 | raw file
- diff -uN gfx/harfbuzz/src_old/check-defs.sh gfx/harfbuzz/src/check-defs.sh
- --- gfx/harfbuzz/src_old/check-defs.sh 1970-01-01 01:00:00.000000000 +0100
- +++ gfx/harfbuzz/src/check-defs.sh 2016-06-05 23:47:59.650463392 +0200
- @@ -0,0 +1,44 @@
- +#!/bin/sh
- +
- +LC_ALL=C
- +export LC_ALL
- +
- +test -z "$srcdir" && srcdir=.
- +test -z "$MAKE" && MAKE=make
- +stat=0
- +
- +if which nm 2>/dev/null >/dev/null; then
- + :
- +else
- + echo "check-defs.sh: 'nm' not found; skipping test"
- + exit 77
- +fi
- +
- +defs="harfbuzz.def"
- +$MAKE $defs > /dev/null
- +tested=false
- +for def in $defs; do
- + lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'`
- + so=.libs/lib${lib}.so
- +
- + EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| llvm_' | cut -d' ' -f3`"
- +
- + if test -f "$so"; then
- +
- + echo "Checking that $so has the same symbol list as $def"
- + {
- + echo EXPORTS
- + echo "$EXPORTED_SYMBOLS"
- + # cheat: copy the last line from the def file!
- + tail -n1 "$def"
- + } | diff "$def" - >&2 || stat=1
- +
- + tested=true
- + fi
- +done
- +if ! $tested; then
- + echo "check-defs.sh: libharfbuzz shared library not found; skipping test"
- + exit 77
- +fi
- +
- +exit $stat
- diff -uN gfx/harfbuzz/src_old/check-header-guards.sh gfx/harfbuzz/src/check-header-guards.sh
- --- gfx/harfbuzz/src_old/check-header-guards.sh 2016-05-10 22:26:55.000000000 +0200
- +++ gfx/harfbuzz/src/check-header-guards.sh 2016-06-05 23:48:00.885456341 +0200
- @@ -9,13 +9,12 @@
- test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'`
- test "x$HBSOURCES" = x && HBSOURCES=`cd "$srcdir"; find . -maxdepth 1 -name 'hb-*.cc' -or -name 'hb-*.hh'`
-
- -
- for x in $HBHEADERS $HBSOURCES; do
- test -f "$srcdir/$x" && x="$srcdir/$x"
- - echo "$x" | grep '[^h]$' -q && continue;
- + echo "$x" | grep -q '[^h]$' && continue;
- xx=`echo "$x" | sed 's@.*/@@'`
- tag=`echo "$xx" | tr 'a-z.-' 'A-Z_'`
- - lines=`grep "\<$tag\>" "$x" | wc -l | sed 's/[ ]*//g'`
- + lines=`grep -w "$tag" "$x" | wc -l | sed 's/[ ]*//g'`
- if test "x$lines" != x3; then
- echo "Ouch, header file $x does not have correct preprocessor guards"
- stat=1
- diff -uN gfx/harfbuzz/src_old/check-libstdc++.sh gfx/harfbuzz/src/check-libstdc++.sh
- --- gfx/harfbuzz/src_old/check-libstdc++.sh 2016-05-10 22:26:55.000000000 +0200
- +++ gfx/harfbuzz/src/check-libstdc++.sh 2016-06-05 23:48:03.413441951 +0200
- @@ -19,9 +19,9 @@
- so=.libs/libharfbuzz.$suffix
- if ! test -f "$so"; then continue; fi
-
- - echo "Checking that we are not linking to libstdc++"
- - if ldd $so | grep 'libstdc[+][+]'; then
- - echo "Ouch, linked to libstdc++"
- + echo "Checking that we are not linking to libstdc++ or libc++"
- + if ldd $so | grep 'libstdc[+][+]\|libc[+][+]'; then
- + echo "Ouch, linked to libstdc++ or libc++"
- stat=1
- fi
- tested=true
- diff -uN gfx/harfbuzz/src_old/gen-indic-table.py gfx/harfbuzz/src/gen-indic-table.py
- --- gfx/harfbuzz/src_old/gen-indic-table.py 2016-05-10 22:26:56.000000000 +0200
- +++ gfx/harfbuzz/src/gen-indic-table.py 2016-06-05 23:48:08.239414549 +0200
- @@ -91,6 +91,7 @@
- "Visarga": 'Vs',
- "Vowel": 'Vo',
- "Vowel_Dependent": 'M',
- + "Consonant_Prefixed": 'CPrf',
- "Other": 'x',
- },{
- "Not_Applicable": 'x',
- @@ -209,7 +210,7 @@
- for (start,end) in zip (starts, ends):
- if p not in [start>>page_bits, end>>page_bits]: continue
- offset = "indic_offset_0x%04xu" % start
- - print " if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return indic_table[u - 0x%04Xu + %s];" % (start, end, start, offset)
- + print " if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return indic_table[u - 0x%04Xu + %s];" % (start, end-1, start, offset)
- for u,d in singles.items ():
- if p != u>>page_bits: continue
- print " if (unlikely (u == 0x%04Xu)) return _(%s,%s);" % (u, short[0][d[0]], short[1][d[1]])
- diff -uN gfx/harfbuzz/src_old/gen-use-table.py gfx/harfbuzz/src/gen-use-table.py
- --- gfx/harfbuzz/src_old/gen-use-table.py 1970-01-01 01:00:00.000000000 +0100
- +++ gfx/harfbuzz/src/gen-use-table.py 2016-06-05 23:48:09.467407592 +0200
- @@ -0,0 +1,476 @@
- +#!/usr/bin/python
- +
- +import sys
- +
- +if len (sys.argv) != 5:
- + print >>sys.stderr, "usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt"
- + sys.exit (1)
- +
- +BLACKLISTED_BLOCKS = ["Thai", "Lao", "Tibetan"]
- +
- +files = [file (x) for x in sys.argv[1:]]
- +
- +headers = [[f.readline () for i in range (2)] for j,f in enumerate(files) if j != 2]
- +headers.append (["UnicodeData.txt does not have a header."])
- +
- +data = [{} for f in files]
- +values = [{} for f in files]
- +for i, f in enumerate (files):
- + for line in f:
- +
- + j = line.find ('#')
- + if j >= 0:
- + line = line[:j]
- +
- + fields = [x.strip () for x in line.split (';')]
- + if len (fields) == 1:
- + continue
- +
- + uu = fields[0].split ('..')
- + start = int (uu[0], 16)
- + if len (uu) == 1:
- + end = start
- + else:
- + end = int (uu[1], 16)
- +
- + t = fields[1 if i != 2 else 2]
- +
- + for u in range (start, end + 1):
- + data[i][u] = t
- + values[i][t] = values[i].get (t, 0) + end - start + 1
- +
- +defaults = ('Other', 'Not_Applicable', 'Cn', 'No_Block')
- +
- +# TODO Characters that are not in Unicode Indic files, but used in USE
- +data[0][0x034F] = defaults[0]
- +data[0][0x2060] = defaults[0]
- +for u in range (0xFE00, 0xFE0F + 1):
- + data[0][u] = defaults[0]
- +
- +# Merge data into one dict:
- +for i,v in enumerate (defaults):
- + values[i][v] = values[i].get (v, 0) + 1
- +combined = {}
- +for i,d in enumerate (data):
- + for u,v in d.items ():
- + if i >= 2 and not u in combined:
- + continue
- + if not u in combined:
- + combined[u] = list (defaults)
- + combined[u][i] = v
- +combined = {k:v for k,v in combined.items() if v[3] not in BLACKLISTED_BLOCKS}
- +data = combined
- +del combined
- +num = len (data)
- +
- +
- +property_names = [
- + # General_Category
- + 'Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu', 'Mc',
- + 'Me', 'Mn', 'Nd', 'Nl', 'No', 'Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po',
- + 'Ps', 'Sc', 'Sk', 'Sm', 'So', 'Zl', 'Zp', 'Zs',
- + # Indic_Syllabic_Category
- + 'Other',
- + 'Bindu',
- + 'Visarga',
- + 'Avagraha',
- + 'Nukta',
- + 'Virama',
- + 'Pure_Killer',
- + 'Invisible_Stacker',
- + 'Vowel_Independent',
- + 'Vowel_Dependent',
- + 'Vowel',
- + 'Consonant_Placeholder',
- + 'Consonant',
- + 'Consonant_Dead',
- + 'Consonant_With_Stacker',
- + 'Consonant_Prefixed',
- + 'Consonant_Preceding_Repha',
- + 'Consonant_Succeeding_Repha',
- + 'Consonant_Subjoined',
- + 'Consonant_Medial',
- + 'Consonant_Final',
- + 'Consonant_Head_Letter',
- + 'Modifying_Letter',
- + 'Tone_Letter',
- + 'Tone_Mark',
- + 'Gemination_Mark',
- + 'Cantillation_Mark',
- + 'Register_Shifter',
- + 'Syllable_Modifier',
- + 'Consonant_Killer',
- + 'Non_Joiner',
- + 'Joiner',
- + 'Number_Joiner',
- + 'Number',
- + 'Brahmi_Joining_Number',
- + # Indic_Positional_Category
- + 'Not_Applicable',
- + 'Right',
- + 'Left',
- + 'Visual_Order_Left',
- + 'Left_And_Right',
- + 'Top',
- + 'Bottom',
- + 'Top_And_Bottom',
- + 'Top_And_Right',
- + 'Top_And_Left',
- + 'Top_And_Left_And_Right',
- + 'Bottom_And_Right',
- + 'Top_And_Bottom_And_Right',
- + 'Overstruck',
- +]
- +
- +class PropertyValue(object):
- + def __init__(self, name_):
- + self.name = name_
- + def __str__(self):
- + return self.name
- + def __eq__(self, other):
- + return self.name == (other if isinstance(other, basestring) else other.name)
- + def __ne__(self, other):
- + return not (self == other)
- +
- +property_values = {}
- +
- +for name in property_names:
- + value = PropertyValue(name)
- + assert value not in property_values
- + assert value not in globals()
- + property_values[name] = value
- +globals().update(property_values)
- +
- +
- +def is_BASE(U, UISC, UGC):
- + return (UISC in [Number, Consonant, Consonant_Head_Letter,
- + #SPEC-OUTDATED Consonant_Placeholder,
- + Tone_Letter] or
- + (UGC == Lo and UISC in [Avagraha, Bindu, Consonant_Final, Consonant_Medial,
- + Consonant_Subjoined, Vowel, Vowel_Dependent]))
- +def is_BASE_VOWEL(U, UISC, UGC):
- + return UISC == Vowel_Independent
- +def is_BASE_IND(U, UISC, UGC):
- + #SPEC-BROKEN return (UISC in [Consonant_Dead, Modifying_Letter] or UGC == Po)
- + return (UISC in [Consonant_Dead, Modifying_Letter] or
- + (UGC == Po and not is_BASE_OTHER(U, UISC, UGC))) # for 104E
- +def is_BASE_NUM(U, UISC, UGC):
- + return UISC == Brahmi_Joining_Number
- +def is_BASE_OTHER(U, UISC, UGC):
- + if UISC == Consonant_Placeholder: return True #SPEC-OUTDATED
- + return U in [0x00A0, 0x00D7, 0x2015, 0x2022, 0x25CC,
- + 0x25FB, 0x25FC, 0x25FD, 0x25FE]
- +def is_CGJ(U, UISC, UGC):
- + return U == 0x034F
- +def is_CONS_FINAL(U, UISC, UGC):
- + return ((UISC == Consonant_Final and UGC != Lo) or
- + UISC == Consonant_Succeeding_Repha)
- +def is_CONS_FINAL_MOD(U, UISC, UGC):
- + #SPEC-OUTDATED return UISC in [Consonant_Final_Modifier, Syllable_Modifier]
- + return UISC == Syllable_Modifier
- +def is_CONS_MED(U, UISC, UGC):
- + return UISC == Consonant_Medial and UGC != Lo
- +def is_CONS_MOD(U, UISC, UGC):
- + return UISC in [Nukta, Gemination_Mark, Consonant_Killer]
- +def is_CONS_SUB(U, UISC, UGC):
- + #SPEC-OUTDATED return UISC == Consonant_Subjoined
- + return UISC == Consonant_Subjoined and UGC != Lo
- +def is_HALANT(U, UISC, UGC):
- + return UISC in [Virama, Invisible_Stacker]
- +def is_HALANT_NUM(U, UISC, UGC):
- + return UISC == Number_Joiner
- +def is_ZWNJ(U, UISC, UGC):
- + return UISC == Non_Joiner
- +def is_ZWJ(U, UISC, UGC):
- + return UISC == Joiner
- +def is_Word_Joiner(U, UISC, UGC):
- + return U == 0x2060
- +def is_OTHER(U, UISC, UGC):
- + #SPEC-OUTDATED return UGC == Zs # or any other SCRIPT_COMMON characters
- + return (UISC == Other
- + and not is_SYM_MOD(U, UISC, UGC)
- + and not is_CGJ(U, UISC, UGC)
- + and not is_Word_Joiner(U, UISC, UGC)
- + and not is_VARIATION_SELECTOR(U, UISC, UGC)
- + )
- +def is_Reserved(U, UISC, UGC):
- + return UGC == 'Cn'
- +def is_REPHA(U, UISC, UGC):
- + #return UISC == Consonant_Preceding_Repha
- + #SPEC-OUTDATED hack to categorize Consonant_With_Stacker and Consonant_Prefixed
- + return UISC in [Consonant_Preceding_Repha, Consonant_With_Stacker, Consonant_Prefixed]
- +def is_SYM(U, UISC, UGC):
- + if U == 0x25CC: return False #SPEC-OUTDATED
- + #SPEC-OUTDATED return UGC in [So, Sc] or UISC == Symbol_Letter
- + return UGC in [So, Sc]
- +def is_SYM_MOD(U, UISC, UGC):
- + return U in [0x1B6B, 0x1B6C, 0x1B6D, 0x1B6E, 0x1B6F, 0x1B70, 0x1B71, 0x1B72, 0x1B73]
- +def is_VARIATION_SELECTOR(U, UISC, UGC):
- + return 0xFE00 <= U <= 0xFE0F
- +def is_VOWEL(U, UISC, UGC):
- + return (UISC == Pure_Killer or
- + (UGC != Lo and UISC in [Vowel, Vowel_Dependent]))
- +def is_VOWEL_MOD(U, UISC, UGC):
- + return (UISC in [Tone_Mark, Cantillation_Mark, Register_Shifter, Visarga] or
- + (UGC != Lo and UISC == Bindu))
- +
- +use_mapping = {
- + 'B': is_BASE,
- + 'IV': is_BASE_VOWEL,
- + 'IND': is_BASE_IND,
- + 'N': is_BASE_NUM,
- + 'GB': is_BASE_OTHER,
- + 'CGJ': is_CGJ,
- + 'F': is_CONS_FINAL,
- + 'FM': is_CONS_FINAL_MOD,
- + 'M': is_CONS_MED,
- + 'CM': is_CONS_MOD,
- + 'SUB': is_CONS_SUB,
- + 'H': is_HALANT,
- + 'HN': is_HALANT_NUM,
- + 'ZWNJ': is_ZWNJ,
- + 'ZWJ': is_ZWJ,
- + 'WJ': is_Word_Joiner,
- + 'O': is_OTHER,
- + 'Rsv': is_Reserved,
- + 'R': is_REPHA,
- + 'S': is_SYM,
- + 'SM': is_SYM_MOD,
- + 'VS': is_VARIATION_SELECTOR,
- + 'V': is_VOWEL,
- + 'VM': is_VOWEL_MOD,
- +}
- +
- +use_positions = {
- + 'F': {
- + 'Abv': [Top],
- + 'Blw': [Bottom],
- + 'Pst': [Right],
- + },
- + 'M': {
- + 'Abv': [Top],
- + 'Blw': [Bottom],
- + 'Pst': [Right],
- + 'Pre': [Left],
- + },
- + 'CM': {
- + 'Abv': [Top],
- + 'Blw': [Bottom],
- + },
- + 'V': {
- + 'Abv': [Top, Top_And_Bottom, Top_And_Bottom_And_Right, Top_And_Right],
- + 'Blw': [Bottom, Overstruck, Bottom_And_Right],
- + 'Pst': [Right],
- + 'Pre': [Left, Top_And_Left, Top_And_Left_And_Right, Left_And_Right],
- + },
- + 'VM': {
- + 'Abv': [Top],
- + 'Blw': [Bottom, Overstruck],
- + 'Pst': [Right],
- + 'Pre': [Left],
- + },
- + 'SM': {
- + 'Abv': [Top],
- + 'Blw': [Bottom],
- + },
- + 'H': None,
- + 'B': None,
- + 'FM': None,
- + 'SUB': None,
- +}
- +
- +def map_to_use(data):
- + out = {}
- + items = use_mapping.items()
- + for U,(UISC,UIPC,UGC,UBlock) in data.items():
- +
- + # Resolve Indic_Syllabic_Category
- +
- + # TODO: These don't have UISC assigned in Unicode 8.0, but
- + # have UIPC
- + if U == 0x17DD: UISC = Vowel_Dependent
- + if 0x1CE2 <= U <= 0x1CE8: UISC = Cantillation_Mark
- +
- + # TODO: U+1CED should only be allowed after some of
- + # the nasalization marks, maybe only for U+1CE9..U+1CF1.
- + if U == 0x1CED: UISC = Tone_Mark
- +
- + evals = [(k, v(U,UISC,UGC)) for k,v in items]
- + values = [k for k,v in evals if v]
- + assert len(values) == 1, "%s %s %s %s" % (hex(U), UISC, UGC, values)
- + USE = values[0]
- +
- + # Resolve Indic_Positional_Category
- +
- + # TODO: Not in Unicode 8.0 yet, but in spec.
- + if U == 0x1B6C: UIPC = Bottom
- +
- + # TODO: These should die, but have UIPC in Unicode 8.0
- + if U in [0x953, 0x954]: UIPC = Not_Applicable
- +
- + # TODO: In USE's override list but not in Unicode 8.0
- + if U == 0x103C: UIPC = Left
- +
- + # TODO: These are not in USE's override list that we have, nor are they in Unicode 8.0
- + if 0xA926 <= U <= 0xA92A: UIPC = Top
- + if U == 0x111CA: UIPC = Bottom
- + if U == 0x11300: UIPC = Top
- + if U == 0x1133C: UIPC = Bottom
- + if U == 0x1171E: UIPC = Left # Correct?!
- + if 0x1CF2 <= U <= 0x1CF3: UIPC = Right
- + if 0x1CF8 <= U <= 0x1CF9: UIPC = Top
- +
- + assert (UIPC in [Not_Applicable, Visual_Order_Left] or
- + USE in use_positions), "%s %s %s %s %s" % (hex(U), UIPC, USE, UISC, UGC)
- +
- + pos_mapping = use_positions.get(USE, None)
- + if pos_mapping:
- + values = [k for k,v in pos_mapping.items() if v and UIPC in v]
- + assert len(values) == 1, "%s %s %s %s %s %s" % (hex(U), UIPC, USE, UISC, UGC, values)
- + USE = USE + values[0]
- +
- + out[U] = (USE, UBlock)
- + return out
- +
- +defaults = ('O', 'No_Block')
- +data = map_to_use(data)
- +
- +# Remove the outliers
- +singles = {}
- +for u in [0x034F, 0x25CC, 0x1107F]:
- + singles[u] = data[u]
- + del data[u]
- +
- +print "/* == Start of generated table == */"
- +print "/*"
- +print " * The following table is generated by running:"
- +print " *"
- +print " * ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt"
- +print " *"
- +print " * on files with these headers:"
- +print " *"
- +for h in headers:
- + for l in h:
- + print " * %s" % (l.strip())
- +print " */"
- +print
- +print '#include "hb-ot-shape-complex-use-private.hh"'
- +print
- +
- +total = 0
- +used = 0
- +last_block = None
- +def print_block (block, start, end, data):
- + global total, used, last_block
- + if block and block != last_block:
- + print
- + print
- + print " /* %s */" % block
- + if start % 16:
- + print ' ' * (20 + (start % 16 * 6)),
- + num = 0
- + assert start % 8 == 0
- + assert (end+1) % 8 == 0
- + for u in range (start, end+1):
- + if u % 16 == 0:
- + print
- + print " /* %04X */" % u,
- + if u in data:
- + num += 1
- + d = data.get (u, defaults)
- + sys.stdout.write ("%6s," % d[0])
- +
- + total += end - start + 1
- + used += num
- + if block:
- + last_block = block
- +
- +uu = data.keys ()
- +uu.sort ()
- +
- +last = -100000
- +num = 0
- +offset = 0
- +starts = []
- +ends = []
- +for k,v in sorted(use_mapping.items()):
- + if k in use_positions and use_positions[k]: continue
- + print "#define %s USE_%s /* %s */" % (k, k, v.__name__[3:])
- +for k,v in sorted(use_positions.items()):
- + if not v: continue
- + for suf in v.keys():
- + tag = k + suf
- + print "#define %s USE_%s" % (tag, tag)
- +print ""
- +print "static const USE_TABLE_ELEMENT_TYPE use_table[] = {"
- +for u in uu:
- + if u <= last:
- + continue
- + block = data[u][1]
- +
- + start = u//8*8
- + end = start+1
- + while end in uu and block == data[end][1]:
- + end += 1
- + end = (end-1)//8*8 + 7
- +
- + if start != last + 1:
- + if start - last <= 1+16*3:
- + print_block (None, last+1, start-1, data)
- + last = start-1
- + else:
- + if last >= 0:
- + ends.append (last + 1)
- + offset += ends[-1] - starts[-1]
- + print
- + print
- + print "#define use_offset_0x%04xu %d" % (start, offset)
- + starts.append (start)
- +
- + print_block (block, start, end, data)
- + last = end
- +ends.append (last + 1)
- +offset += ends[-1] - starts[-1]
- +print
- +print
- +occupancy = used * 100. / total
- +page_bits = 12
- +print "}; /* Table items: %d; occupancy: %d%% */" % (offset, occupancy)
- +print
- +print "USE_TABLE_ELEMENT_TYPE"
- +print "hb_use_get_categories (hb_codepoint_t u)"
- +print "{"
- +print " switch (u >> %d)" % page_bits
- +print " {"
- +pages = set([u>>page_bits for u in starts+ends+singles.keys()])
- +for p in sorted(pages):
- + print " case 0x%0Xu:" % p
- + for (start,end) in zip (starts, ends):
- + if p not in [start>>page_bits, end>>page_bits]: continue
- + offset = "use_offset_0x%04xu" % start
- + print " if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return use_table[u - 0x%04Xu + %s];" % (start, end-1, start, offset)
- + for u,d in singles.items ():
- + if p != u>>page_bits: continue
- + print " if (unlikely (u == 0x%04Xu)) return %s;" % (u, d[0])
- + print " break;"
- + print ""
- +print " default:"
- +print " break;"
- +print " }"
- +print " return USE_O;"
- +print "}"
- +print
- +for k in sorted(use_mapping.keys()):
- + if k in use_positions and use_positions[k]: continue
- + print "#undef %s" % k
- +for k,v in sorted(use_positions.items()):
- + if not v: continue
- + for suf in v.keys():
- + tag = k + suf
- + print "#undef %s" % tag
- +print
- +print "/* == End of generated table == */"
- +
- +# Maintain at least 50% occupancy in the table */
- +if occupancy < 50:
- + raise Exception ("Table too sparse, please investigate: ", occupancy)
- diff -uN gfx/harfbuzz/src_old/harfbuzz-icu.pc gfx/harfbuzz/src/harfbuzz-icu.pc
- --- gfx/harfbuzz/src_old/harfbuzz-icu.pc 1970-01-01 01:00:00.000000000 +0100
- +++ gfx/harfbuzz/src/harfbuzz-icu.pc 2016-06-05 23:48:12.049392976 +0200
- @@ -0,0 +1,13 @@
- +prefix=/usr/local
- +exec_prefix=/usr/local
- +libdir=/usr/local/lib
- +includedir=/usr/local/include
- +
- +Name: harfbuzz
- +Description: HarfBuzz text shaping library ICU integration
- +Version: 1.0.1
- +
- +Requires: harfbuzz
- +Requires.private: icu-uc
- +Libs: -L${libdir} -lharfbuzz-icu
- +Cflags: -I${includedir}/harfbuzz
- diff -uN gfx/harfbuzz/src_old/harfbuzz.pc gfx/harfbuzz/src/harfbuzz.pc
- --- gfx/harfbuzz/src_old/harfbuzz.pc 1970-01-01 01:00:00.000000000 +0100
- +++ gfx/harfbuzz/src/harfbuzz.pc 2016-06-05 23:48:14.499379160 +0200
- @@ -0,0 +1,11 @@
- +prefix=/usr/local
- +exec_prefix=/usr/local
- +libdir=/usr/local/lib
- +includedir=/usr/local/include
- +
- +Name: harfbuzz
- +Description: HarfBuzz text shaping library
- +Version: 1.0.1
- +
- +Libs: -L${libdir} -lharfbuzz
- +Cflags: -I${includedir}/harfbuzz
- diff -uN gfx/harfbuzz/src_old/harfbuzz.pc.in gfx/harfbuzz/src/harfbuzz.pc.in
- --- gfx/harfbuzz/src_old/harfbuzz.pc.in 2016-05-10 22:26:55.000000000 +0200
- +++ gfx/harfbuzz/src/harfbuzz.pc.in 2016-06-05 23:48:15.731372204 +0200
- @@ -8,4 +8,6 @@
- Version: %VERSION%
-
- Libs: -L${libdir} -lharfbuzz
- +Libs.private: %libs_private%
- +Requires.private: %requires_private%
- Cflags: -I${includedir}/harfbuzz
- diff -uN gfx/harfbuzz/src_old/hb-atomic-private.hh gfx/harfbuzz/src/hb-atomic-private.hh
- --- gfx/harfbuzz/src_old/hb-atomic-private.hh 2016-05-10 22:26:56.000000000 +0200
- +++ gfx/harfbuzz/src/hb-atomic-private.hh 2016-06-05 23:48:16.918365513 +0200
- @@ -39,7 +39,11 @@
-
- /* We need external help for these */
-
- -#if 0
- +#if defined(hb_atomic_int_impl_add) \
- + && defined(hb_atomic_ptr_impl_get) \
- + && defined(hb_atomic_ptr_impl_cmpexch)
- +
- +/* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */
-
-
- #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
- @@ -58,11 +62,12 @@
- #endif
- }
-
- -typedef LONG hb_atomic_int_t;
- -#define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
- +typedef LONG hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
-
- -#define hb_atomic_ptr_get(P) (_HBMemoryBarrier (), (void *) *(P))
- -#define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
- +#define hb_atomic_ptr_impl_get(P) (_HBMemoryBarrier (), (void *) *(P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
-
-
- #elif !defined(HB_NO_MT) && defined(__APPLE__)
- @@ -74,28 +79,31 @@
- #include <Availability.h>
- #endif
-
- -typedef int32_t hb_atomic_int_t;
- -#define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
-
- -#define hb_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P))
- +typedef int32_t hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
- +
- +#define hb_atomic_ptr_impl_get(P) (OSMemoryBarrier (), (void *) *(P))
- #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
- -#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
- #else
- #if __ppc64__ || __x86_64__ || __aarch64__
- -#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P))
- #else
- -#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P))
- #endif
- #endif
-
-
- #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
-
- -typedef int hb_atomic_int_t;
- -#define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))
- +typedef int hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add (&(AI), (V))
-
- -#define hb_atomic_ptr_get(P) (void *) (__sync_synchronize (), *(P))
- -#define hb_atomic_ptr_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
- +#define hb_atomic_ptr_impl_get(P) (void *) (__sync_synchronize (), *(P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
-
-
- #elif !defined(HB_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS)
- @@ -103,33 +111,79 @@
- #include <atomic.h>
- #include <mbarrier.h>
-
- -typedef unsigned int hb_atomic_int_t;
- -#define hb_atomic_int_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
- +typedef unsigned int hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
- +
- +#define hb_atomic_ptr_impl_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false)
- +
- +
- +#elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
- +
- +#include <builtins.h>
- +
- +
- +static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) {
- + __lwsync();
- + int result = __fetch_and_add(AI, V);
- + __isync();
- + return result;
- +}
- +static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
- + __sync();
- + int result = __compare_and_swaplp (P, &O, N);
- + __sync();
- + return result;
- +}
-
- -#define hb_atomic_ptr_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P))
- -#define hb_atomic_ptr_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false)
- +typedef int hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) hb_fetch_and_add (&(AI), (V))
-
- +#define hb_atomic_ptr_impl_get(P) (__sync(), (void *) *(P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
-
- #elif !defined(HB_NO_MT)
-
- #define HB_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
- -typedef volatile int hb_atomic_int_t;
- -#define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V))
-
- -#define hb_atomic_ptr_get(P) ((void *) *(P))
- -#define hb_atomic_ptr_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
- +typedef volatile int hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) (((AI) += (V)) - (V))
- +
- +#define hb_atomic_ptr_impl_get(P) ((void *) *(P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
-
-
- #else /* HB_NO_MT */
-
- -typedef int hb_atomic_int_t;
- -#define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V))
- +typedef int hb_atomic_int_impl_t;
- +#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
- +#define hb_atomic_int_impl_add(AI, V) (((AI) += (V)) - (V))
- +
- +#define hb_atomic_ptr_impl_get(P) ((void *) *(P))
- +#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false)
-
- -#define hb_atomic_ptr_get(P) ((void *) *(P))
- -#define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false)
-
- #endif
-
- -/* TODO Add tracing. */
- +
- +#define HB_ATOMIC_INT_INIT(V) {HB_ATOMIC_INT_IMPL_INIT(V)}
- +
- +struct hb_atomic_int_t
- +{
- + hb_atomic_int_impl_t v;
- +
- + inline void set_unsafe (int v_) { v = v_; }
- + inline int get_unsafe (void) const { return v; }
- + inline int inc (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_int_impl_t &> (v), 1); }
- + inline int dec (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_int_impl_t &> (v), -1); }
- +};
- +
- +
- +#define hb_atomic_ptr_get(P) hb_atomic_ptr_impl_get(P)
- +#define hb_atomic_ptr_cmpexch(P,O,N) hb_atomic_ptr_impl_cmpexch((P),(O),(N))
- +
-
- #endif /* HB_ATOMIC_PRIVATE_HH */
- diff -uN gfx/harfbuzz/src_old/hb-blob.cc gfx/harfbuzz/src/hb-blob.cc
- --- gfx/harfbuzz/src_old/hb-blob.cc 2016-05-10 22:26:55.000000000 +0200
- +++ gfx/harfbuzz/src/hb-blob.cc 2016-06-05 23:48:18.064359059 +0200
- @@ -78,8 +78,8 @@
- }
-
- /**
- - * hb_blob_create: (Xconstructor)
- - * @data: (array length=length) (closure user_data) (destroy destroy) (scope notified) (transfer none): Pointer to blob data.
- + * hb_blob_create: (skip)
- + * @data: Pointer to blob data.
- * @length: Length of @data in bytes.
- * @mode: Memory mode for @data.
- * @user_data: Data parameter to pass to @destroy.
- @@ -91,7 +91,7 @@
- * Return value: New blob, or the empty blob if something failed or if @length is
- * zero. Destroy with hb_blob_destroy().
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_blob_t *
- hb_blob_create (const char *data,
- @@ -147,7 +147,7 @@
- * @length is zero or @offset is beyond the end of @parent's data. Destroy
- * with hb_blob_destroy().
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_blob_t *
- hb_blob_create_sub_blob (hb_blob_t *parent,
- @@ -179,7 +179,7 @@
- *
- * Return value: (transfer full): the empty blob.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_blob_t *
- hb_blob_get_empty (void)
- @@ -210,7 +210,7 @@
- *
- * Return value: @blob.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_blob_t *
- hb_blob_reference (hb_blob_t *blob)
- @@ -228,7 +228,7 @@
- *
- * See TODO:link object types for more information.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_blob_destroy (hb_blob_t *blob)
- @@ -250,7 +250,7 @@
- *
- * Return value:
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_bool_t
- hb_blob_set_user_data (hb_blob_t *blob,
- @@ -271,7 +271,7 @@
- *
- * Return value: (transfer none):
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void *
- hb_blob_get_user_data (hb_blob_t *blob,
- @@ -287,7 +287,7 @@
- *
- *
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_blob_make_immutable (hb_blob_t *blob)
- @@ -306,7 +306,7 @@
- *
- * Return value: TODO
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_bool_t
- hb_blob_is_immutable (hb_blob_t *blob)
- @@ -323,7 +323,7 @@
- *
- * Return value: the length of blob data in bytes.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- unsigned int
- hb_blob_get_length (hb_blob_t *blob)
- @@ -340,7 +340,7 @@
- *
- * Returns: (transfer none) (array length=length):
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- const char *
- hb_blob_get_data (hb_blob_t *blob, unsigned int *length)
- @@ -365,7 +365,7 @@
- * Returns: (transfer none) (array length=length): Writable blob data,
- * or %NULL if failed.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- char *
- hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length)
- diff -uN gfx/harfbuzz/src_old/hb-blob.h gfx/harfbuzz/src/hb-blob.h
- --- gfx/harfbuzz/src_old/hb-blob.h 2016-05-10 22:26:56.000000000 +0200
- +++ gfx/harfbuzz/src/hb-blob.h 2016-06-05 23:48:19.231352500 +0200
- @@ -64,7 +64,7 @@
-
- typedef struct hb_blob_t hb_blob_t;
-
- -hb_blob_t *
- +HB_EXTERN hb_blob_t *
- hb_blob_create (const char *data,
- unsigned int length,
- hb_memory_mode_t mode,
- @@ -77,21 +77,21 @@
- * modify the parent data as that data may be
- * shared among multiple sub-blobs.
- */
- -hb_blob_t *
- +HB_EXTERN hb_blob_t *
- hb_blob_create_sub_blob (hb_blob_t *parent,
- unsigned int offset,
- unsigned int length);
-
- -hb_blob_t *
- +HB_EXTERN hb_blob_t *
- hb_blob_get_empty (void);
-
- -hb_blob_t *
- +HB_EXTERN hb_blob_t *
- hb_blob_reference (hb_blob_t *blob);
-
- -void
- +HB_EXTERN void
- hb_blob_destroy (hb_blob_t *blob);
-
- -hb_bool_t
- +HB_EXTERN hb_bool_t
- hb_blob_set_user_data (hb_blob_t *blob,
- hb_user_data_key_t *key,
- void * data,
- @@ -99,25 +99,25 @@
- hb_bool_t replace);
-
-
- -void *
- +HB_EXTERN void *
- hb_blob_get_user_data (hb_blob_t *blob,
- hb_user_data_key_t *key);
-
-
- -void
- +HB_EXTERN void
- hb_blob_make_immutable (hb_blob_t *blob);
-
- -hb_bool_t
- +HB_EXTERN hb_bool_t
- hb_blob_is_immutable (hb_blob_t *blob);
-
-
- -unsigned int
- +HB_EXTERN unsigned int
- hb_blob_get_length (hb_blob_t *blob);
-
- -const char *
- +HB_EXTERN const char *
- hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
-
- -char *
- +HB_EXTERN char *
- hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length);
-
-
- diff -uN gfx/harfbuzz/src_old/hb-buffer.cc gfx/harfbuzz/src/hb-buffer.cc
- --- gfx/harfbuzz/src_old/hb-buffer.cc 2016-05-10 22:26:55.000000000 +0200
- +++ gfx/harfbuzz/src/hb-buffer.cc 2016-06-05 23:48:28.261301901 +0200
- @@ -35,7 +35,28 @@
- #define HB_DEBUG_BUFFER (HB_DEBUG+0)
- #endif
-
- +/**
- + * SECTION: hb-buffer
- + * @title: Buffers
- + * @short_description: Input and output buffers
- + * @include: hb.h
- + *
- + * Buffers serve dual role in HarfBuzz; they hold the input characters that are
- + * passed hb_shape(), and after shaping they hold the output glyphs.
- + **/
-
- +/**
- + * hb_segment_properties_equal:
- + * @a: first #hb_segment_properties_t to compare.
- + * @b: second #hb_segment_properties_t to compare.
- + *
- + * Checks the equality of two #hb_segment_properties_t's.
- + *
- + * Return value: (transfer full):
- + * %true if all properties of @a equal those of @b, false otherwise.
- + *
- + * Since: 0.9.7
- + **/
- hb_bool_t
- hb_segment_properties_equal (const hb_segment_properties_t *a,
- const hb_segment_properties_t *b)
- @@ -48,6 +69,17 @@
-
- }
-
- +/**
- + * hb_segment_properties_hash:
- + * @p: #hb_segment_properties_t to hash.
- + *
- + * Creates a hash representing @p.
- + *
- + * Return value:
- + * A hash of @p.
- + *
- + * Since: 0.9.7
- + **/
- unsigned int
- hb_segment_properties_hash (const hb_segment_properties_t *p)
- {
- @@ -85,6 +117,11 @@
- {
- if (unlikely (in_error))
- return false;
- + if (unlikely (size > max_len))
- + {
- + in_error = true;
- + return false;
- + }
-
- unsigned int new_allocated = allocated;
- hb_glyph_position_t *new_pos = NULL;
- @@ -192,6 +229,7 @@
-
- hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
- props = default_props;
- + scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
-
- content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
- in_error = false;
- @@ -443,7 +481,7 @@
- {
- unsigned int i, j;
-
- - if (start == end - 1)
- + if (end - start < 2)
- return;
-
- for (i = start, j = end - 1; i < j; i++, j--) {
- @@ -454,7 +492,7 @@
- info[j] = t;
- }
-
- - if (pos) {
- + if (have_positions) {
- for (i = start, j = end - 1; i < j; i++, j--) {
- hb_glyph_position_t t;
-
- @@ -498,14 +536,10 @@
- }
-
- void
- -hb_buffer_t::merge_clusters (unsigned int start,
- - unsigned int end)
- +hb_buffer_t::merge_clusters_impl (unsigned int start,
- + unsigned int end)
- {
- -#ifdef HB_NO_MERGE_CLUSTERS
- - return;
- -#endif
- -
- - if (unlikely (end - start < 2))
- + if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)
- return;
-
- unsigned int cluster = info[start].cluster;
- @@ -523,7 +557,7 @@
-
- /* If we hit the start of buffer, continue in out-buffer. */
- if (idx == start)
- - for (unsigned i = out_len; i && out_info[i - 1].cluster == info[start].cluster; i--)
- + for (unsigned int i = out_len; i && out_info[i - 1].cluster == info[start].cluster; i--)
- out_info[i - 1].cluster = cluster;
-
- for (unsigned int i = start; i < end; i++)
- @@ -533,9 +567,8 @@
- hb_buffer_t::merge_out_clusters (unsigned int start,
- unsigned int end)
- {
- -#ifdef HB_NO_MERGE_CLUSTERS
- - return;
- -#endif
- + if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)
- + return;
-
- if (unlikely (end - start < 2))
- return;
- @@ -555,12 +588,44 @@
-
- /* If we hit the end of out-buffer, continue in buffer. */
- if (end == out_len)
- - for (unsigned i = idx; i < len && info[i].cluster == out_info[end - 1].cluster; i++)
- + for (unsigned int i = idx; i < len && info[i].cluster == out_info[end - 1].cluster; i++)
- info[i].cluster = cluster;
-
- for (unsigned int i = start; i < end; i++)
- out_info[i].cluster = cluster;
- }
- +void
- +hb_buffer_t::delete_glyph ()
- +{
- + unsigned int cluster = info[idx].cluster;
- + if (idx + 1 < len && cluster == info[idx + 1].cluster)
- + {
- + /* Cluster survives; do nothing. */
- + goto done;
- + }
- +
- + if (out_len)
- + {
- + /* Merge cluster backward. */
- + if (cluster < out_info[out_len - 1].cluster)
- + {
- + unsigned int old_cluster = out_info[out_len - 1].cluster;
- + for (unsigned i = out_len; i && out_info[i - 1].cluster == old_cluster; i--)
- + out_info[i - 1].cluster = cluster;
- + }
- + goto done;
- + }
- +
- + if (idx + 1 < len)
- + {
- + /* Merge cluster forward. */
- + merge_clusters (idx, idx + 2);
- + goto done;
- + }
- +
- +done:
- + skip_glyph ();
- +}
-
- void
- hb_buffer_t::guess_segment_properties (void)
- @@ -667,11 +732,16 @@
- /**
- * hb_buffer_create: (Xconstructor)
- *
- - *
- + * Creates a new #hb_buffer_t with all properties to defaults.
- *
- - * Return value: (transfer full)
- + * Return value: (transfer full):
- + * A newly allocated #hb_buffer_t with a reference count of 1. The initial
- + * reference count should be released with hb_buffer_destroy() when you are done
- + * using the #hb_buffer_t. This function never returns %NULL. If memory cannot
- + * be allocated, a special #hb_buffer_t object will be returned on which
- + * hb_buffer_allocation_successful() returns %false.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_buffer_t *
- hb_buffer_create (void)
- @@ -681,6 +751,8 @@
- if (!(buffer = hb_object_create<hb_buffer_t> ()))
- return hb_buffer_get_empty ();
-
- + buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
- +
- buffer->reset ();
-
- return buffer;
- @@ -693,7 +765,7 @@
- *
- * Return value: (transfer full):
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_buffer_t *
- hb_buffer_get_empty (void)
- @@ -703,7 +775,10 @@
-
- const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil),
- HB_BUFFER_FLAG_DEFAULT,
- + HB_BUFFER_CLUSTER_LEVEL_DEFAULT,
- HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
- + HB_BUFFER_SCRATCH_FLAG_DEFAULT,
- + HB_BUFFER_MAX_LEN_DEFAULT,
-
- HB_BUFFER_CONTENT_TYPE_INVALID,
- HB_SEGMENT_PROPERTIES_DEFAULT,
- @@ -719,13 +794,15 @@
-
- /**
- * hb_buffer_reference: (skip)
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * Increases the reference count on @buffer by one. This prevents @buffer from
- + * being destroyed until a matching call to hb_buffer_destroy() is made.
- *
- * Return value: (transfer full):
- + * The referenced #hb_buffer_t.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_buffer_t *
- hb_buffer_reference (hb_buffer_t *buffer)
- @@ -735,11 +812,13 @@
-
- /**
- * hb_buffer_destroy: (skip)
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * Deallocate the @buffer.
- + * Decreases the reference count on @buffer by one. If the result is zero, then
- + * @buffer and all associated resources are freed. See hb_buffer_reference().
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_buffer_destroy (hb_buffer_t *buffer)
- @@ -750,13 +829,15 @@
-
- free (buffer->info);
- free (buffer->pos);
- + if (buffer->message_destroy)
- + buffer->message_destroy (buffer->message_data);
-
- free (buffer);
- }
-
- /**
- * hb_buffer_set_user_data: (skip)
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- * @key:
- * @data:
- * @destroy:
- @@ -766,7 +847,7 @@
- *
- * Return value:
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_bool_t
- hb_buffer_set_user_data (hb_buffer_t *buffer,
- @@ -780,14 +861,14 @@
-
- /**
- * hb_buffer_get_user_data: (skip)
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- * @key:
- *
- *
- *
- * Return value:
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void *
- hb_buffer_get_user_data (hb_buffer_t *buffer,
- @@ -799,12 +880,13 @@
-
- /**
- * hb_buffer_set_content_type:
- - * @buffer: a buffer.
- - * @content_type:
- + * @buffer: an #hb_buffer_t.
- + * @content_type: the type of buffer contents to set
- *
- - *
- + * Sets the type of @buffer contents, buffers are either empty, contain
- + * characters (before shaping) or glyphs (the result of shaping).
- *
- - * Since: 1.0
- + * Since: 0.9.5
- **/
- void
- hb_buffer_set_content_type (hb_buffer_t *buffer,
- @@ -815,13 +897,14 @@
-
- /**
- * hb_buffer_get_content_type:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * see hb_buffer_set_content_type().
- *
- - * Return value:
- + * Return value:
- + * The type of @buffer contents.
- *
- - * Since: 1.0
- + * Since: 0.9.5
- **/
- hb_buffer_content_type_t
- hb_buffer_get_content_type (hb_buffer_t *buffer)
- @@ -832,12 +915,12 @@
-
- /**
- * hb_buffer_set_unicode_funcs:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- * @unicode_funcs:
- *
- *
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
- @@ -857,13 +940,13 @@
-
- /**
- * hb_buffer_get_unicode_funcs:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- *
- *
- * Return value:
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_unicode_funcs_t *
- hb_buffer_get_unicode_funcs (hb_buffer_t *buffer)
- @@ -873,12 +956,18 @@
-
- /**
- * hb_buffer_set_direction:
- - * @buffer: a buffer.
- - * @direction:
- + * @buffer: an #hb_buffer_t.
- + * @direction: the #hb_direction_t of the @buffer
- *
- - *
- + * Set the text flow direction of the buffer. No shaping can happen without
- + * setting @buffer direction, and it controls the visual direction for the
- + * output glyphs; for RTL direction the glyphs will be reversed. Many layout
- + * features depend on the proper setting of the direction, for example,
- + * reversing RTL text before shaping, then shaping with LTR direction is not
- + * the same as keeping the text in logical order and shaping with RTL
- + * direction.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_buffer_set_direction (hb_buffer_t *buffer,
- @@ -893,13 +982,14 @@
-
- /**
- * hb_buffer_get_direction:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * See hb_buffer_set_direction()
- *
- - * Return value:
- + * Return value:
- + * The direction of the @buffer.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_direction_t
- hb_buffer_get_direction (hb_buffer_t *buffer)
- @@ -909,12 +999,20 @@
-
- /**
- * hb_buffer_set_script:
- - * @buffer: a buffer.
- - * @script:
- + * @buffer: an #hb_buffer_t.
- + * @script: an #hb_script_t to set.
- *
- - *
- + * Sets the script of @buffer to @script.
- *
- - * Since: 1.0
- + * Script is crucial for choosing the proper shaping behaviour for scripts that
- + * require it (e.g. Arabic) and the which OpenType features defined in the font
- + * to be applied.
- + *
- + * You can pass one of the predefined #hb_script_t values, or use
- + * hb_script_from_string() or hb_script_from_iso15924_tag() to get the
- + * corresponding script from an ISO 15924 script tag.
- + *
- + * Since: 0.9.2
- **/
- void
- hb_buffer_set_script (hb_buffer_t *buffer,
- @@ -928,13 +1026,14 @@
-
- /**
- * hb_buffer_get_script:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * See hb_buffer_set_script().
- *
- - * Return value:
- + * Return value:
- + * The #hb_script_t of the @buffer.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_script_t
- hb_buffer_get_script (hb_buffer_t *buffer)
- @@ -944,12 +1043,20 @@
-
- /**
- * hb_buffer_set_language:
- - * @buffer: a buffer.
- - * @language:
- + * @buffer: an #hb_buffer_t.
- + * @language: an hb_language_t to set.
- *
- - *
- + * Sets the language of @buffer to @language.
- + *
- + * Languages are crucial for selecting which OpenType feature to apply to the
- + * buffer which can result in applying language-specific behaviour. Languages
- + * are orthogonal to the scripts, and though they are related, they are
- + * different concepts and should not be confused with each other.
- + *
- + * Use hb_language_from_string() to convert from ISO 639 language codes to
- + * #hb_language_t.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_buffer_set_language (hb_buffer_t *buffer,
- @@ -963,13 +1070,14 @@
-
- /**
- * hb_buffer_get_language:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * See hb_buffer_set_language().
- *
- - * Return value:
- + * Return value: (transfer none):
- + * The #hb_language_t of the buffer. Must not be freed by the caller.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_language_t
- hb_buffer_get_language (hb_buffer_t *buffer)
- @@ -979,12 +1087,14 @@
-
- /**
- * hb_buffer_set_segment_properties:
- - * @buffer: a buffer.
- - * @props:
- + * @buffer: an #hb_buffer_t.
- + * @props: an #hb_segment_properties_t to use.
- *
- - *
- + * Sets the segment properties of the buffer, a shortcut for calling
- + * hb_buffer_set_direction(), hb_buffer_set_script() and
- + * hb_buffer_set_language() individually.
- *
- - * Since: 1.0
- + * Since: 0.9.7
- **/
- void
- hb_buffer_set_segment_properties (hb_buffer_t *buffer,
- @@ -998,12 +1108,12 @@
-
- /**
- * hb_buffer_get_segment_properties:
- - * @buffer: a buffer.
- - * @props:
- + * @buffer: an #hb_buffer_t.
- + * @props: (out): the output #hb_segment_properties_t.
- *
- - *
- + * Sets @props to the #hb_segment_properties_t of @buffer.
- *
- - * Since: 1.0
- + * Since: 0.9.7
- **/
- void
- hb_buffer_get_segment_properties (hb_buffer_t *buffer,
- @@ -1015,12 +1125,12 @@
-
- /**
- * hb_buffer_set_flags:
- - * @buffer: a buffer.
- - * @flags:
- + * @buffer: an #hb_buffer_t.
- + * @flags: the buffer flags to set.
- *
- - *
- + * Sets @buffer flags to @flags. See #hb_buffer_flags_t.
- *
- - * Since: 1.0
- + * Since: 0.9.7
- **/
- void
- hb_buffer_set_flags (hb_buffer_t *buffer,
- @@ -1034,13 +1144,14 @@
-
- /**
- * hb_buffer_get_flags:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * See hb_buffer_set_flags().
- *
- * Return value:
- + * The @buffer flags.
- *
- - * Since: 1.0
- + * Since: 0.9.7
- **/
- hb_buffer_flags_t
- hb_buffer_get_flags (hb_buffer_t *buffer)
- @@ -1048,15 +1159,53 @@
- return buffer->flags;
- }
-
- +/**
- + * hb_buffer_set_cluster_level:
- + * @buffer: an #hb_buffer_t.
- + * @cluster_level:
- + *
- + *
- + *
- + * Since: 0.9.42
- + **/
- +void
- +hb_buffer_set_cluster_level (hb_buffer_t *buffer,
- + hb_buffer_cluster_level_t cluster_level)
- +{
- + if (unlikely (hb_object_is_inert (buffer)))
- + return;
- +
- + buffer->cluster_level = cluster_level;
- +}
- +
- +/**
- + * hb_buffer_get_cluster_level:
- + * @buffer: an #hb_buffer_t.
- + *
- + *
- + *
- + * Return value:
- + *
- + * Since: 0.9.42
- + **/
- +hb_buffer_cluster_level_t
- +hb_buffer_get_cluster_level (hb_buffer_t *buffer)
- +{
- + return buffer->cluster_level;
- +}
- +
-
- /**
- * hb_buffer_set_replacement_codepoint:
- - * @buffer: a buffer.
- - * @replacement:
- + * @buffer: an #hb_buffer_t.
- + * @replacement: the replacement #hb_codepoint_t
- *
- - *
- + * Sets the #hb_codepoint_t that replaces invalid entries for a given encoding
- + * when adding text to @buffer.
- *
- - * Since: 1.0
- + * Default is %HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT.
- + *
- + * Since: 0.9.31
- **/
- void
- hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer,
- @@ -1070,13 +1219,14 @@
-
- /**
- * hb_buffer_get_replacement_codepoint:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * See hb_buffer_set_replacement_codepoint().
- *
- * Return value:
- + * The @buffer replacement #hb_codepoint_t.
- *
- - * Since: 1.0
- + * Since: 0.9.31
- **/
- hb_codepoint_t
- hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer)
- @@ -1087,11 +1237,12 @@
-
- /**
- * hb_buffer_reset:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * Resets the buffer to its initial status, as if it was just newly created
- + * with hb_buffer_create().
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_buffer_reset (hb_buffer_t *buffer)
- @@ -1101,11 +1252,12 @@
-
- /**
- * hb_buffer_clear_contents:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * Similar to hb_buffer_reset(), but does not clear the Unicode functions and
- + * the replacement code point.
- *
- - * Since: 1.0
- + * Since: 0.9.11
- **/
- void
- hb_buffer_clear_contents (hb_buffer_t *buffer)
- @@ -1115,14 +1267,15 @@
-
- /**
- * hb_buffer_pre_allocate:
- - * @buffer: a buffer.
- - * @size:
- + * @buffer: an #hb_buffer_t.
- + * @size: number of items to pre allocate.
- *
- - *
- + * Pre allocates memory for @buffer to fit at least @size number of items.
- *
- - * Return value:
- + * Return value:
- + * %true if @buffer memory allocation succeeded, %false otherwise.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_bool_t
- hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size)
- @@ -1132,13 +1285,14 @@
-
- /**
- * hb_buffer_allocation_successful:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- - *
- + * Check if allocating memory for the buffer succeeded.
- *
- - * Return value:
- + * Return value:
- + * %true if @buffer memory allocation succeeded, %false otherwise.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_bool_t
- hb_buffer_allocation_successful (hb_buffer_t *buffer)
- @@ -1148,13 +1302,20 @@
-
- /**
- * hb_buffer_add:
- - * @buffer: a buffer.
- - * @codepoint:
- - * @cluster:
- + * @buffer: an #hb_buffer_t.
- + * @codepoint: a Unicode code point.
- + * @cluster: the cluster value of @codepoint.
- + *
- + * Appends a character with the Unicode value of @codepoint to @buffer, and
- + * gives it the initial cluster value of @cluster. Clusters can be any thing
- + * the client wants, they are usually used to refer to the index of the
- + * character in the input text stream and are output in
- + * #hb_glyph_info_t.cluster field.
- *
- - *
- + * This function does not check the validity of @codepoint, it is up to the
- + * caller to ensure it is a valid Unicode code point.
- *
- - * Since: 1.0
- + * Since: 0.9.7
- **/
- void
- hb_buffer_add (hb_buffer_t *buffer,
- @@ -1167,14 +1328,16 @@
-
- /**
- * hb_buffer_set_length:
- - * @buffer: a buffer.
- - * @length:
- + * @buffer: an #hb_buffer_t.
- + * @length: the new length of @buffer.
- *
- - *
- + * Similar to hb_buffer_pre_allocate(), but clears any new items added at the
- + * end.
- *
- * Return value:
- + * %true if @buffer memory allocation succeeded, %false otherwise.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_bool_t
- hb_buffer_set_length (hb_buffer_t *buffer,
- @@ -1207,13 +1370,15 @@
-
- /**
- * hb_buffer_get_length:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- * Returns the number of items in the buffer.
- *
- - * Return value: buffer length.
- + * Return value:
- + * The @buffer length.
- + * The value valid as long as buffer has not been modified.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- unsigned int
- hb_buffer_get_length (hb_buffer_t *buffer)
- @@ -1223,15 +1388,17 @@
-
- /**
- * hb_buffer_get_glyph_infos:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- * @length: (out): output array length.
- *
- - * Returns buffer glyph information array. Returned pointer
- - * is valid as long as buffer contents are not modified.
- + * Returns @buffer glyph information array. Returned pointer
- + * is valid as long as @buffer contents are not modified.
- *
- - * Return value: (transfer none) (array length=length): buffer glyph information array.
- + * Return value: (transfer none) (array length=length):
- + * The @buffer glyph information array.
- + * The value valid as long as buffer has not been modified.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_glyph_info_t *
- hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
- @@ -1245,15 +1412,17 @@
-
- /**
- * hb_buffer_get_glyph_positions:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- * @length: (out): output length.
- *
- - * Returns buffer glyph position array. Returned pointer
- - * is valid as long as buffer contents are not modified.
- + * Returns @buffer glyph position array. Returned pointer
- + * is valid as long as @buffer contents are not modified.
- *
- - * Return value: (transfer none) (array length=length): buffer glyph position array.
- + * Return value: (transfer none) (array length=length):
- + * The @buffer glyph position array.
- + * The value valid as long as buffer has not been modified.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- hb_glyph_position_t *
- hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
- @@ -1270,11 +1439,11 @@
-
- /**
- * hb_buffer_reverse:
- - * @buffer: a buffer.
- + * @buffer: an #hb_buffer_t.
- *
- * Reverses buffer contents.
- *
- - * Since: 1.0
- + * Since: 0.9.2
- **/
- void
- hb_buffer_reverse (hb_buffer_t *buffer)
- @@ -1283,14 +1452,31 @@
- }
-
- /**
- + * hb_buffer_reverse_range:
- + * @buffer: an #hb_buffer_t.
- + * @start: start index.
- + * @end: end index.
- + *
- + * Reverses buffer contents between start to end.
- + *
- + * Since: 0.9.41
- + **/
- +void
- +hb_buffer_reverse_range (hb_buffer_t *buffer,
- + unsigned int start, unsigned int end)
- +{
- + buffer->reverse_range (start, end);
- +}
- +
- +/**
- * hb_buffer_reverse_clusters:
- -