configure.ac | 12 + src/Makefile.am | 7 src/hb-coretext-private.hh | 42 ++++ src/hb-coretext.cc | 323 +++++++++++++++++++++++++++++++++++ src/hb-coretext.h | 43 ++++ src/hb-open-file-private.hh | 8 src/hb-ot-head-table.hh | 2 src/hb-ot-hhea-table.hh | 2 src/hb-ot-hmtx-table.hh | 2 src/hb-ot-layout-common-private.hh | 14 - src/hb-ot-layout-gdef-table.hh | 20 +- src/hb-ot-layout-gpos-table.hh | 48 ++--- src/hb-ot-layout-gsub-table.hh | 30 +-- src/hb-ot-layout-gsubgpos-private.hh | 32 +-- src/hb-ot-maxp-table.hh | 2 src/hb-ot-name-table.hh | 2 src/hb-shape.cc | 6 17 files changed, 515 insertions(+), 80 deletions(-)
New commits: commit aa6d849838d5231465ae1a25a4dd5ea1e9380ff9 Author: Jonathan Kew <jfkth...@gmail.com> Date: Tue Jul 24 15:52:32 2012 -0400 [CoreText] Add basic Core Text backend for comparison with our native shaping Does not attempt to handle clusters in a Uniscribe- or HarfBuzz-compatible way; just returns the original string indexes that CT maintains. These may even be out-of-order in the case of reordrant glyphs. diff --git a/configure.ac b/configure.ac index cbabf83..030b04a 100644 --- a/configure.ac +++ b/configure.ac @@ -186,6 +186,18 @@ AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe) dnl =========================================================================== +AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, have_coretext=true, have_coretext=false) +if $have_coretext; then + CORETEXT_CFLAGS= + CORETEXT_LIBS= + AC_SUBST(CORETEXT_CFLAGS) + AC_SUBST(CORETEXT_LIBS) + AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend]) +fi +AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext) + +dnl =========================================================================== + AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [ hb_cv_have_intel_atomic_primitives=false AC_TRY_LINK([ diff --git a/src/Makefile.am b/src/Makefile.am index 9fd135a..f2fce6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,6 +138,13 @@ HBSOURCES += hb-uniscribe.cc hb-uniscribe-private.hh HBHEADERS += hb-uniscribe.h endif +if HAVE_CORETEXT +HBCFLAGS += $(CORETEXT_CFLAGS) +HBLIBS += $(CORETEXT_LIBS) +HBSOURCES += hb-coretext.cc hb-coretext-private.hh +HBHEADERS += hb-coretext.h +endif + # Use a C linker, not C++; Don't link to libstdc++ libharfbuzz_la_LINK = $(LINK) $(libharfbuzz_la_LDFLAGS) libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS) diff --git a/src/hb-coretext-private.hh b/src/hb-coretext-private.hh new file mode 100644 index 0000000..153106c --- /dev/null +++ b/src/hb-coretext-private.hh @@ -0,0 +1,42 @@ +/* + * Copyright © 2012 Mozilla Foundation. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Mozilla Author(s): Jonathan Kew + */ + +#ifndef HB_CORETEXT_PRIVATE_HH +#define HB_CORETEXT_PRIVATE_HH + +#include "hb-private.hh" + +#include "hb-coretext.h" + + +HB_INTERNAL hb_bool_t +_hb_coretext_shape (hb_font_t *font, + hb_buffer_t *buffer, + const hb_feature_t *features, + unsigned int num_features); + + +#endif /* HB_CORETEXT_PRIVATE_HH */ diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc new file mode 100644 index 0000000..f49e76e --- /dev/null +++ b/src/hb-coretext.cc @@ -0,0 +1,323 @@ +/* + * Copyright © 2012 Mozilla Foundation. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Mozilla Author(s): Jonathan Kew + */ + +#include "hb-private.hh" + +#define GlyphID GlyphID_mac +#include <ApplicationServices/ApplicationServices.h> +#undef GlyphID + +#include "hb-coretext.h" + +#include "hb-ot-name-table.hh" +#include "hb-ot-tag.h" + +#include "hb-font-private.hh" +#include "hb-buffer-private.hh" + + +#ifndef HB_DEBUG_CORETEXT +#define HB_DEBUG_CORETEXT (HB_DEBUG+0) +#endif + + +static hb_user_data_key_t hb_coretext_data_key; + +static struct hb_coretext_face_data_t { + CGFontRef cg_font; +} _hb_coretext_face_data_nil = {0}; + +static void +_hb_coretext_face_data_destroy (hb_coretext_face_data_t *data) +{ + if (data->cg_font) + CFRelease (data->cg_font); + free (data); +} + +static void +release_data (void *info, const void *data, size_t size) +{ + assert (hb_blob_get_length ((hb_blob_t *) info) == size && + hb_blob_get_data ((hb_blob_t *) info, NULL) == data); + + hb_blob_destroy ((hb_blob_t *) info); +} + +static hb_coretext_face_data_t * +_hb_coretext_face_get_data (hb_face_t *face) +{ + hb_coretext_face_data_t *data = (hb_coretext_face_data_t *) hb_face_get_user_data (face, &hb_coretext_data_key); + if (likely (data)) return data; + + data = (hb_coretext_face_data_t *) calloc (1, sizeof (hb_coretext_face_data_t)); + if (unlikely (!data)) + return &_hb_coretext_face_data_nil; + + + hb_blob_t *blob = hb_face_reference_blob (face); + unsigned int blob_length; + const char *blob_data = hb_blob_get_data (blob, &blob_length); + if (unlikely (!blob_length)) + DEBUG_MSG (CORETEXT, face, "Face has empty blob"); + + CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data); + data->cg_font = CGFontCreateWithDataProvider (provider); + CGDataProviderRelease (provider); + + if (unlikely (!data->cg_font)) + DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed"); + + + if (unlikely (!hb_face_set_user_data (face, &hb_coretext_data_key, data, + (hb_destroy_func_t) _hb_coretext_face_data_destroy, + false))) + { + _hb_coretext_face_data_destroy (data); + data = (hb_coretext_face_data_t *) hb_face_get_user_data (face, &hb_coretext_data_key); + if (data) + return data; + else + return &_hb_coretext_face_data_nil; + } + + return data; +} + + +static struct hb_coretext_font_data_t { + CTFontRef ct_font; +} _hb_coretext_font_data_nil = {0}; + +static void +_hb_coretext_font_data_destroy (hb_coretext_font_data_t *data) +{ + if (data->ct_font) + CFRelease (data->ct_font); + free (data); +} + +static hb_coretext_font_data_t * +_hb_coretext_font_get_data (hb_font_t *font) +{ + hb_coretext_font_data_t *data = (hb_coretext_font_data_t *) hb_font_get_user_data (font, &hb_coretext_data_key); + if (likely (data)) return data; + + data = (hb_coretext_font_data_t *) calloc (1, sizeof (hb_coretext_font_data_t)); + if (unlikely (!data)) + return &_hb_coretext_font_data_nil; + + hb_coretext_face_data_t *face_data = _hb_coretext_face_get_data (font->face); + + data->ct_font = CTFontCreateWithGraphicsFont (face_data->cg_font, font->y_scale, NULL, NULL); + if (unlikely (!data->ct_font)) + DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed"); + + if (unlikely (!hb_font_set_user_data (font, &hb_coretext_data_key, data, + (hb_destroy_func_t) _hb_coretext_font_data_destroy, + false))) + { + _hb_coretext_font_data_destroy (data); + data = (hb_coretext_font_data_t *) hb_font_get_user_data (font, &hb_coretext_data_key); + if (data) + return data; + else + return &_hb_coretext_font_data_nil; + } + + return data; +} + +CTFontRef +hb_coretext_font_get_ct_font (hb_font_t *font) +{ + hb_coretext_font_data_t *font_data = _hb_coretext_font_get_data (font); + if (unlikely (!font_data)) + return 0; + return font_data->ct_font; +} + + +hb_bool_t +_hb_coretext_shape (hb_font_t *font, + hb_buffer_t *buffer, + const hb_feature_t *features, + unsigned int num_features) +{ + buffer->guess_properties (); + +#define FAIL(...) \ + HB_STMT_START { \ + DEBUG_MSG (CORETEXT, NULL, __VA_ARGS__); \ + return false; \ + } HB_STMT_END; + + hb_coretext_face_data_t *face_data = _hb_coretext_face_get_data (font->face); + if (unlikely (!face_data->cg_font)) + FAIL ("Couldn't get face data"); + + hb_coretext_font_data_t *font_data = _hb_coretext_font_get_data (font); + if (unlikely (!font_data->ct_font)) + FAIL ("Couldn't get font font"); + + if (unlikely (!buffer->len)) + return true; + + unsigned int scratch_size; + char *scratch = (char *) buffer->get_scratch_buffer (&scratch_size); + +#define utf16_index() var1.u32 + + UniChar *pchars = (UniChar *) scratch; + unsigned int chars_len = 0; + for (unsigned int i = 0; i < buffer->len; i++) { + hb_codepoint_t c = buffer->info[i].codepoint; + buffer->info[i].utf16_index() = chars_len; + if (likely (c < 0x10000)) + pchars[chars_len++] = c; + else if (unlikely (c >= 0x110000)) + pchars[chars_len++] = 0xFFFD; + else { + pchars[chars_len++] = 0xD800 + ((c - 0x10000) >> 10); + pchars[chars_len++] = 0xDC00 + ((c - 0x10000) & ((1 << 10) - 1)); + } + } + +#undef utf16_index + + CFStringRef string_ref = CFStringCreateWithCharactersNoCopy (kCFAllocatorDefault, + pchars, chars_len, + kCFAllocatorNull); + + CFDictionaryRef attrs = CFDictionaryCreate (kCFAllocatorDefault, + (const void**) &kCTFontAttributeName, + (const void**) &font_data->ct_font, + 1, // count of attributes + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + // TODO: support features + + // Now we can create an attributed string + CFAttributedStringRef attr_string = CFAttributedStringCreate (kCFAllocatorDefault, string_ref, attrs); + CFRelease (string_ref); + CFRelease (attrs); + + // Create the CoreText line from our string, then we're done with it + CTLineRef line = CTLineCreateWithAttributedString (attr_string); + CFRelease (attr_string); + + // and finally retrieve the glyph data and store into the gfxTextRun + CFArrayRef glyph_runs = CTLineGetGlyphRuns (line); + unsigned int num_runs = CFArrayGetCount (glyph_runs); + + // Iterate through the glyph runs. + bool success = true; + buffer->len = 0; + + const CFRange range_all = CFRangeMake (0, 0); + + for (unsigned int i = 0; i < num_runs; i++) { + CTRunRef run = (CTRunRef) CFArrayGetValueAtIndex (glyph_runs, i); + + unsigned int num_glyphs = CTRunGetGlyphCount (run); + if (num_glyphs == 0) + continue; + + buffer->ensure (buffer->len + num_glyphs); + + // retrieve the laid-out glyph data from the CTRun + + // Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds, + // and so copying data to our own buffer with CTRunGetGlyphs will be + // extremely rare. + + unsigned int scratch_size; + char *scratch = (char *) buffer->get_scratch_buffer (&scratch_size); + +#define ALLOCATE_ARRAY(Type, name, len) \ + Type *name = (Type *) scratch; \ + scratch += len * sizeof (name[0]); \ + scratch_size -= len * sizeof (name[0]); + + const CGGlyph* glyphs = CTRunGetGlyphsPtr (run); + if (!glyphs) { + ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs); + CTRunGetGlyphs (run, range_all, glyph_buf); + glyphs = glyph_buf; + } + + const CGPoint* positions = CTRunGetPositionsPtr (run); + if (!positions) { + ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs); + CTRunGetPositions (run, range_all, position_buf); + positions = position_buf; + } + + const CFIndex* string_indices = CTRunGetStringIndicesPtr (run); + if (!string_indices) { + ALLOCATE_ARRAY (CFIndex, index_buf, num_glyphs); + CTRunGetStringIndices (run, range_all, index_buf); + string_indices = index_buf; + } + +#undef ALLOCATE_ARRAY + + double run_width = CTRunGetTypographicBounds (run, range_all, NULL, NULL, NULL); + + for (unsigned int j = 0; j < num_glyphs; j++) { + double advance = (j + 1 < num_glyphs ? positions[j + 1].x : positions[0].x + run_width) - positions[j].x; + + hb_glyph_info_t *info = &buffer->info[buffer->len]; + hb_glyph_position_t *pos = &buffer->pos[buffer->len]; + + info->codepoint = glyphs[j]; + info->cluster = string_indices[j]; + + // currently, we do all x-positioning by setting the advance, we never use x-offset + info->mask = advance; + info->var1.u32 = 0; + info->var2.u32 = positions[j].y; + + buffer->len++; + } + } + + buffer->clear_positions (); + + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; ++i) { + hb_glyph_info_t *info = &buffer->info[i]; + hb_glyph_position_t *pos = &buffer->pos[i]; + + /* TODO vertical */ + pos->x_advance = info->mask; + pos->x_offset = info->var1.u32; + pos->y_offset = info->var2.u32; + } + + return true; +} diff --git a/src/hb-coretext.h b/src/hb-coretext.h new file mode 100644 index 0000000..0b34203 --- /dev/null +++ b/src/hb-coretext.h @@ -0,0 +1,43 @@ +/* + * Copyright © 2012 Mozilla Foundation. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Mozilla Author(s): Jonathan Kew + */ + +#ifndef HB_CORETEXT_H +#define HB_CORETEXT_H + +#include "hb.h" + +#include <ApplicationServices/ApplicationServices.h> + +HB_BEGIN_DECLS + + +CTFontRef +hb_coretext_font_get_ct_font (hb_font_t *font); + + +HB_END_DECLS + +#endif /* HB_CORETEXT_H */ diff --git a/src/hb-shape.cc b/src/hb-shape.cc index 60a2dce..57a979b 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -36,6 +36,9 @@ #ifdef HAVE_UNISCRIBE # include "hb-uniscribe-private.hh" #endif +#ifdef HAVE_CORETEXT +# include "hb-coretext-private.hh" +#endif #ifdef HAVE_OT # include "hb-ot-shape-private.hh" #endif @@ -58,6 +61,9 @@ static const struct hb_shaper_pair_t { #ifdef HAVE_UNISCRIBE HB_SHAPER_IMPLEMENT (uniscribe), #endif +#ifdef HAVE_CORETEXT + HB_SHAPER_IMPLEMENT (coretext), +#endif #ifdef HAVE_OT HB_SHAPER_IMPLEMENT (ot), #endif commit ec8d2494694275dfbbac2dd0d33ca2894b0463d6 Author: Behdad Esfahbod <beh...@behdad.org> Date: Tue Jul 24 15:40:37 2012 -0400 Make data members of various OpenType structs protected instead of private Should fix warnings generated when building with -Wunused-private-field. Based on patch from Jonathan Kew. diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index ce18580..e2d4a2c 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -105,7 +105,7 @@ typedef struct OffsetTable return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, TableRecord::static_size, numTables)); } - private: + protected: Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */ USHORT numTables; /* Number of tables. */ USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */ @@ -133,7 +133,7 @@ struct TTCHeaderVersion1 return TRACE_RETURN (table.sanitize (c, this)); } - private: + protected: Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ FixedVersion version; /* Version of the TTC Header (1.0), * 0x00010000 */ @@ -177,7 +177,7 @@ struct TTCHeader } } - private: + protected: union { struct { Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ @@ -242,7 +242,7 @@ struct OpenTypeFontFile } } - private: + protected: union { Tag tag; /* 4-byte identifier. */ OpenTypeFontFace fontFace; diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh index 32d64ca..bf2d245 100644 --- a/src/hb-ot-head-table.hh +++ b/src/hb-ot-head-table.hh @@ -54,7 +54,7 @@ struct head return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); } - private: + protected: FixedVersion version; /* Version of the head table--currently * 0x00010000 for version 1.0. */ FixedVersion fontRevision; /* Set by font manufacturer. */ diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh index 2eea05a..24f8bdc 100644 --- a/src/hb-ot-hhea-table.hh +++ b/src/hb-ot-hhea-table.hh @@ -47,7 +47,7 @@ struct hhea return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); } - private: + protected: FixedVersion version; /* 0x00010000 for version 1.0. */ FWORD ascender; /* Typographic ascent. <a * href="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html"> diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 35cfb48..cc7cfbb 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -57,7 +57,7 @@ struct hmtx return TRACE_RETURN (true); } - private: + protected: LongHorMetric longHorMetric[VAR]; /* Paired advance width and left side * bearing values for each glyph. The * value numOfHMetrics comes from diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index a990b15..c7e458f 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -231,7 +231,7 @@ struct Script return TRACE_RETURN (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this)); } - private: + protected: OffsetTo<LangSys> defaultLangSys; /* Offset to DefaultLangSys table--from * beginning of Script table--may be Null */ @@ -379,7 +379,7 @@ struct CoverageFormat1 unsigned int i; }; - private: + protected: USHORT coverageFormat; /* Format identifier--format = 1 */ SortedArrayOf<GlyphID> glyphArray; /* Array of GlyphIDs--in numerical order */ @@ -454,7 +454,7 @@ struct CoverageFormat2 unsigned int i, j, coverage; }; - private: + protected: USHORT coverageFormat; /* Format identifier--format = 2 */ SortedArrayOf<RangeRecord> rangeRecord; /* Array of glyph ranges--ordered by @@ -560,7 +560,7 @@ struct Coverage } u; }; - private: + protected: union { USHORT format; /* Format identifier */ CoverageFormat1 format1; @@ -600,6 +600,7 @@ struct ClassDefFormat1 return false; } + protected: USHORT classFormat; /* Format identifier--format = 1 */ GlyphID startGlyph; /* First GlyphID of the classValueArray */ ArrayOf<USHORT> @@ -634,6 +635,7 @@ struct ClassDefFormat2 return false; } + protected: USHORT classFormat; /* Format identifier--format = 2 */ SortedArrayOf<RangeRecord> rangeRecord; /* Array of glyph ranges--ordered by @@ -673,7 +675,7 @@ struct ClassDef } } - private: + protected: union { USHORT format; /* Format identifier */ ClassDefFormat1 format1; @@ -744,7 +746,7 @@ struct Device return TRACE_RETURN (c->check_struct (this) && c->check_range (this, this->get_size ())); } - private: + protected: USHORT startSize; /* Smallest size to correct--in ppem */ USHORT endSize; /* Largest size to correct--in ppem */ USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index f29fc14..54149d7 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -74,7 +74,7 @@ struct AttachList return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this)); } - private: + protected: OffsetTo<Coverage> coverage; /* Offset to Coverage table -- from * beginning of AttachList table */ @@ -104,7 +104,7 @@ struct CaretValueFormat1 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT caretValueFormat; /* Format identifier--format = 1 */ SHORT coordinate; /* X or Y value, in design units */ public: @@ -130,7 +130,7 @@ struct CaretValueFormat2 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT caretValueFormat; /* Format identifier--format = 2 */ USHORT caretValuePoint; /* Contour point index on glyph */ public: @@ -153,7 +153,7 @@ struct CaretValueFormat3 return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this)); } - private: + protected: USHORT caretValueFormat; /* Format identifier--format = 3 */ SHORT coordinate; /* X or Y value, in design units */ OffsetTo<Device> @@ -187,7 +187,7 @@ struct CaretValue } } - private: + protected: union { USHORT format; /* Format identifier */ CaretValueFormat1 format1; @@ -222,7 +222,7 @@ struct LigGlyph return TRACE_RETURN (carets.sanitize (c, this)); } - private: + protected: OffsetArrayOf<CaretValue> carets; /* Offset array of CaretValue tables * --from beginning of LigGlyph table @@ -256,7 +256,7 @@ struct LigCaretList return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this)); } - private: + protected: OffsetTo<Coverage> coverage; /* Offset to Coverage table--from * beginning of LigCaretList table */ @@ -278,7 +278,7 @@ struct MarkGlyphSetsFormat1 return TRACE_RETURN (coverage.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ LongOffsetArrayOf<Coverage> coverage; /* Array of long offsets to mark set @@ -306,7 +306,7 @@ struct MarkGlyphSets } } - private: + protected: union { USHORT format; /* Format identifier */ MarkGlyphSetsFormat1 format1; @@ -392,7 +392,7 @@ struct GDEF } - private: + protected: FixedVersion version; /* Version of the GDEF table--currently * 0x00010002 */ OffsetTo<ClassDef> diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 9eadbd6..e95aa3e 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -225,7 +225,7 @@ struct AnchorFormat1 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ SHORT xCoordinate; /* Horizontal value--in design units */ SHORT yCoordinate; /* Vertical value--in design units */ @@ -257,7 +257,7 @@ struct AnchorFormat2 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ SHORT xCoordinate; /* Horizontal value--in design units */ SHORT yCoordinate; /* Vertical value--in design units */ @@ -288,7 +288,7 @@ struct AnchorFormat3 return TRACE_RETURN (c->check_struct (this) && xDeviceTable.sanitize (c, this) && yDeviceTable.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 3 */ SHORT xCoordinate; /* Horizontal value--in design units */ SHORT yCoordinate; /* Vertical value--in design units */ @@ -329,7 +329,7 @@ struct Anchor } } - private: + protected: union { USHORT format; /* Format identifier */ AnchorFormat1 format1; @@ -360,7 +360,7 @@ struct AnchorMatrix } USHORT rows; /* Number of rows */ - private: + protected: OffsetTo<Anchor> matrix[VAR]; /* Matrix of offsets to Anchor tables-- * from beginning of AnchorMatrix table */ @@ -378,7 +378,7 @@ struct MarkRecord return TRACE_RETURN (c->check_struct (this) && markAnchor.sanitize (c, base)); } - private: + protected: USHORT klass; /* Class defined for this mark */ OffsetTo<Anchor> markAnchor; /* Offset to Anchor table--from @@ -447,7 +447,7 @@ struct SinglePosFormat1 return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && valueFormat.sanitize_value (c, this, values)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -487,7 +487,7 @@ struct SinglePosFormat2 return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && valueFormat.sanitize_values (c, this, values, valueCount)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -526,7 +526,7 @@ struct SinglePos } } - private: + protected: union { USHORT format; /* Format identifier */ SinglePosFormat1 format1; @@ -539,7 +539,7 @@ struct PairValueRecord { friend struct PairSet; - private: + protected: GlyphID secondGlyph; /* GlyphID of second glyph in the * pair--first glyph is listed in the * Coverage table */ @@ -601,7 +601,7 @@ struct PairSet && closure->valueFormats[1].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride)); } - private: + protected: USHORT len; /* Number of PairValueRecords */ USHORT array[VAR]; /* Array of PairValueRecords--ordered * by GlyphID of the second glyph */ @@ -643,7 +643,7 @@ struct PairPosFormat1 return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && pairSet.sanitize (c, this, &closure)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -715,7 +715,7 @@ struct PairPosFormat2 valueFormat2.sanitize_values_stride_unsafe (c, this, &values[len1], count, stride)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -770,7 +770,7 @@ struct PairPos } } - private: + protected: union { USHORT format; /* Format identifier */ PairPosFormat1 format1; @@ -788,7 +788,7 @@ struct EntryExitRecord return TRACE_RETURN (entryAnchor.sanitize (c, base) && exitAnchor.sanitize (c, base)); } - private: + protected: OffsetTo<Anchor> entryAnchor; /* Offset to EntryAnchor table--from * beginning of CursivePos @@ -893,7 +893,7 @@ struct CursivePosFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && entryExitRecord.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -928,7 +928,7 @@ struct CursivePos } } - private: + protected: union { USHORT format; /* Format identifier */ CursivePosFormat1 format1; @@ -977,7 +977,7 @@ struct MarkBasePosFormat1 markArray.sanitize (c, this) && baseArray.sanitize (c, this, (unsigned int) classCount)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> markCoverage; /* Offset to MarkCoverage table--from @@ -1019,7 +1019,7 @@ struct MarkBasePos } } - private: + protected: union { USHORT format; /* Format identifier */ MarkBasePosFormat1 format1; @@ -1092,7 +1092,7 @@ struct MarkLigPosFormat1 markArray.sanitize (c, this) && ligatureArray.sanitize (c, this, (unsigned int) classCount)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> markCoverage; /* Offset to Mark Coverage table--from @@ -1135,7 +1135,7 @@ struct MarkLigPos } } - private: + protected: union { USHORT format; /* Format identifier */ MarkLigPosFormat1 format1; @@ -1189,7 +1189,7 @@ struct MarkMarkPosFormat1 && mark2Array.sanitize (c, this, (unsigned int) classCount)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> mark1Coverage; /* Offset to Combining Mark1 Coverage @@ -1233,7 +1233,7 @@ struct MarkMarkPos } } - private: + protected: union { USHORT format; /* Format identifier */ MarkMarkPosFormat1 format1; @@ -1359,7 +1359,7 @@ struct PosLookupSubTable } } - private: + protected: union { struct { USHORT sub_format; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 007d21c..600a92a 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -75,7 +75,7 @@ struct SingleSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && deltaGlyphID.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -127,7 +127,7 @@ struct SingleSubstFormat2 return TRACE_RETURN (coverage.sanitize (c, this) && substitute.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -184,7 +184,7 @@ struct SingleSubst } } - private: + protected: union { USHORT format; /* Format identifier */ SingleSubstFormat1 format1; @@ -229,7 +229,7 @@ struct Sequence return TRACE_RETURN (substitute.sanitize (c)); } - private: + protected: ArrayOf<GlyphID> substitute; /* String of GlyphIDs to substitute */ public: @@ -272,7 +272,7 @@ struct MultipleSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && sequence.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -325,7 +325,7 @@ struct MultipleSubst } } - private: + protected: union { USHORT format; /* Format identifier */ MultipleSubstFormat1 format1; @@ -394,7 +394,7 @@ struct AlternateSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && alternateSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -447,7 +447,7 @@ struct AlternateSubst } } - private: + protected: union { USHORT format; /* Format identifier */ AlternateSubstFormat1 format1; @@ -544,7 +544,7 @@ struct Ligature return TRACE_RETURN (ligGlyph.sanitize (c) && component.sanitize (c)); } - private: + protected: GlyphID ligGlyph; /* GlyphID of ligature to substitute */ HeadlessArrayOf<GlyphID> component; /* Array of component GlyphIDs--start @@ -599,7 +599,7 @@ struct LigatureSet return TRACE_RETURN (ligature.sanitize (c, this)); } - private: + protected: OffsetArrayOf<Ligature> ligature; /* Array LigatureSet tables * ordered by preference */ @@ -647,7 +647,7 @@ struct LigatureSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && ligatureSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -700,7 +700,7 @@ struct LigatureSubst } } - private: + protected: union { USHORT format; /* Format identifier */ LigatureSubstFormat1 format1; @@ -844,7 +844,7 @@ struct ReverseChainSingleSubstFormat1 return TRACE_RETURN (substitute.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -897,7 +897,7 @@ struct ReverseChainSingleSubst } } - private: + protected: union { USHORT format; /* Format identifier */ ReverseChainSingleSubstFormat1 format1; @@ -1013,7 +1013,7 @@ struct SubstLookupSubTable } } - private: + protected: union { struct { USHORT sub_format; diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d50c653..14d36b0 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -167,7 +167,7 @@ struct hb_apply_context_t } unsigned int idx; - private: + protected: hb_apply_context_t *c; unsigned int num_items; hb_mask_t mask; @@ -216,7 +216,7 @@ struct hb_apply_context_t } unsigned int idx; - private: + protected: hb_apply_context_t *c; unsigned int num_items; hb_mask_t mask; @@ -588,7 +588,7 @@ struct Rule + lookupRecordX[0].static_size * lookupCount); } - private: + protected: USHORT inputCount; /* Total number of glyphs in input * glyph sequence--includes the first * glyph */ @@ -640,7 +640,7 @@ struct RuleSet return TRACE_RETURN (rule.sanitize (c, this)); } - private: + protected: OffsetArrayOf<Rule> rule; /* Array of Rule tables * ordered by preference */ @@ -709,7 +709,7 @@ struct ContextFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -786,7 +786,7 @@ struct ContextFormat2 return TRACE_RETURN (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -864,7 +864,7 @@ struct ContextFormat3 return TRACE_RETURN (c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount)); } - private: + protected: USHORT format; /* Format identifier--format = 3 */ USHORT glyphCount; /* Number of glyphs in the input glyph * sequence */ @@ -925,7 +925,7 @@ struct Context } } - private: + protected: union { USHORT format; /* Format identifier */ ContextFormat1 format1; @@ -1079,7 +1079,7 @@ struct ChainRule return TRACE_RETURN (lookup.sanitize (c)); } - private: + protected: ArrayOf<USHORT> backtrack; /* Array of backtracking values * (to be matched before the input @@ -1134,7 +1134,7 @@ struct ChainRuleSet return TRACE_RETURN (rule.sanitize (c, this)); } - private: + protected: OffsetArrayOf<ChainRule> rule; /* Array of ChainRule tables * ordered by preference */ @@ -1199,7 +1199,7 @@ struct ChainContextFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -1287,7 +1287,7 @@ struct ChainContextFormat2 ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo<Coverage> coverage; /* Offset to Coverage table--from @@ -1392,7 +1392,7 @@ struct ChainContextFormat3 return TRACE_RETURN (lookup.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 3 */ OffsetArrayOf<Coverage> backtrack; /* Array of coverage tables @@ -1460,7 +1460,7 @@ struct ChainContext } } - private: + protected: union { USHORT format; /* Format identifier */ ChainContextFormat1 format1; @@ -1483,7 +1483,7 @@ struct ExtensionFormat1 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT format; /* Format identifier. Set to 1. */ USHORT extensionLookupType; /* Lookup type of subtable referenced * by ExtensionOffset (i.e. the @@ -1520,7 +1520,7 @@ struct Extension } } - private: + protected: union { USHORT format; /* Format identifier */ ExtensionFormat1 format1; diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh index e270490..c2c90d1 100644 --- a/src/hb-ot-maxp-table.hh +++ b/src/hb-ot-maxp-table.hh @@ -52,7 +52,7 @@ struct maxp } /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */ - private: + protected: FixedVersion version; /* Version of the maxp table (0.5 or 1.0), * 0x00005000 or 0x00010000. */ USHORT numGlyphs; /* The number of glyphs in the font. */ diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 9077c8c..e0d2e89 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -114,7 +114,7 @@ struct name } /* We only implement format 0 for now. */ - private: + protected: USHORT format; /* Format selector (=0/1). */ USHORT count; /* Number of name records. */ Offset stringOffset; /* Offset to start of string storage (from start of table). */
_______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/harfbuzz