< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cmap-table.hh

Print this page




 363       *glyph = nonDefaults[i].glyphID;
 364        return GLYPH_VARIANT_FOUND;
 365     }
 366     return GLYPH_VARIANT_NOT_FOUND;
 367   }
 368 
 369   inline int cmp (const hb_codepoint_t &variation_selector) const
 370   {
 371     return varSelector.cmp (variation_selector);
 372   }
 373 
 374   inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
 375   {
 376     TRACE_SANITIZE (this);
 377     return_trace (c->check_struct (this) &&
 378                   defaultUVS.sanitize (c, base) &&
 379                   nonDefaultUVS.sanitize (c, base));
 380   }
 381 
 382   UINT24        varSelector;    /* Variation selector. */
 383   OffsetTo<DefaultUVS, ULONG>
 384                 defaultUVS;     /* Offset to Default UVS Table. May be 0. */
 385   OffsetTo<NonDefaultUVS, ULONG>
 386                 nonDefaultUVS;  /* Offset to Non-Default UVS Table. May be 0. */
 387   public:
 388   DEFINE_SIZE_STATIC (11);
 389 };
 390 
 391 struct CmapSubtableFormat14
 392 {
 393   inline glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
 394                                             hb_codepoint_t variation_selector,
 395                                             hb_codepoint_t *glyph) const
 396   {
 397     return record[record.bsearch(variation_selector)].get_glyph (codepoint, glyph, this);
 398   }
 399 
 400   inline bool sanitize (hb_sanitize_context_t *c) const
 401   {
 402     TRACE_SANITIZE (this);
 403     return_trace (c->check_struct (this) &&
 404                   record.sanitize (c, this));
 405   }


 469 {
 470   inline int cmp (const EncodingRecord &other) const
 471   {
 472     int ret;
 473     ret = platformID.cmp (other.platformID);
 474     if (ret) return ret;
 475     ret = encodingID.cmp (other.encodingID);
 476     if (ret) return ret;
 477     return 0;
 478   }
 479 
 480   inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
 481   {
 482     TRACE_SANITIZE (this);
 483     return_trace (c->check_struct (this) &&
 484                   subtable.sanitize (c, base));
 485   }
 486 
 487   USHORT        platformID;     /* Platform ID. */
 488   USHORT        encodingID;     /* Platform-specific encoding ID. */
 489   OffsetTo<CmapSubtable, ULONG>
 490                 subtable;       /* Byte offset from beginning of table to the subtable for this encoding. */
 491   public:
 492   DEFINE_SIZE_STATIC (8);
 493 };
 494 
 495 struct cmap
 496 {
 497   static const hb_tag_t tableTag        = HB_OT_TAG_cmap;
 498 
 499   inline const CmapSubtable *find_subtable (unsigned int platform_id,
 500                                             unsigned int encoding_id) const
 501   {
 502     EncodingRecord key;
 503     key.platformID.set (platform_id);
 504     key.encodingID.set (encoding_id);
 505 
 506     /* Note: We can use bsearch, but since it has no performance
 507      * implications, we use lsearch and as such accept fonts with
 508      * unsorted subtable list. */
 509     int result = encodingRecord./*bsearch*/lsearch (key);
 510     if (result == -1 || !encodingRecord[result].subtable)
 511       return NULL;
 512 
 513     return &(this+encodingRecord[result].subtable);
 514   }
 515 
 516   inline bool sanitize (hb_sanitize_context_t *c) const
 517   {
 518     TRACE_SANITIZE (this);
 519     return_trace (c->check_struct (this) &&
 520                   likely (version == 0) &&
 521                   encodingRecord.sanitize (c, this));
 522   }
 523 
 524   USHORT                version;        /* Table version number (0). */
 525   SortedArrayOf<EncodingRecord>
 526                         encodingRecord; /* Encoding tables. */
 527   public:
 528   DEFINE_SIZE_ARRAY (4, encodingRecord);
 529 };
 530 
 531 


 363       *glyph = nonDefaults[i].glyphID;
 364        return GLYPH_VARIANT_FOUND;
 365     }
 366     return GLYPH_VARIANT_NOT_FOUND;
 367   }
 368 
 369   inline int cmp (const hb_codepoint_t &variation_selector) const
 370   {
 371     return varSelector.cmp (variation_selector);
 372   }
 373 
 374   inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
 375   {
 376     TRACE_SANITIZE (this);
 377     return_trace (c->check_struct (this) &&
 378                   defaultUVS.sanitize (c, base) &&
 379                   nonDefaultUVS.sanitize (c, base));
 380   }
 381 
 382   UINT24        varSelector;    /* Variation selector. */
 383   LOffsetTo<DefaultUVS>
 384                 defaultUVS;     /* Offset to Default UVS Table. May be 0. */
 385   LOffsetTo<NonDefaultUVS>
 386                 nonDefaultUVS;  /* Offset to Non-Default UVS Table. May be 0. */
 387   public:
 388   DEFINE_SIZE_STATIC (11);
 389 };
 390 
 391 struct CmapSubtableFormat14
 392 {
 393   inline glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
 394                                             hb_codepoint_t variation_selector,
 395                                             hb_codepoint_t *glyph) const
 396   {
 397     return record[record.bsearch(variation_selector)].get_glyph (codepoint, glyph, this);
 398   }
 399 
 400   inline bool sanitize (hb_sanitize_context_t *c) const
 401   {
 402     TRACE_SANITIZE (this);
 403     return_trace (c->check_struct (this) &&
 404                   record.sanitize (c, this));
 405   }


 469 {
 470   inline int cmp (const EncodingRecord &other) const
 471   {
 472     int ret;
 473     ret = platformID.cmp (other.platformID);
 474     if (ret) return ret;
 475     ret = encodingID.cmp (other.encodingID);
 476     if (ret) return ret;
 477     return 0;
 478   }
 479 
 480   inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
 481   {
 482     TRACE_SANITIZE (this);
 483     return_trace (c->check_struct (this) &&
 484                   subtable.sanitize (c, base));
 485   }
 486 
 487   USHORT        platformID;     /* Platform ID. */
 488   USHORT        encodingID;     /* Platform-specific encoding ID. */
 489   LOffsetTo<CmapSubtable>
 490                 subtable;       /* Byte offset from beginning of table to the subtable for this encoding. */
 491   public:
 492   DEFINE_SIZE_STATIC (8);
 493 };
 494 
 495 struct cmap
 496 {
 497   static const hb_tag_t tableTag        = HB_OT_TAG_cmap;
 498 
 499   inline const CmapSubtable *find_subtable (unsigned int platform_id,
 500                                             unsigned int encoding_id) const
 501   {
 502     EncodingRecord key;
 503     key.platformID.set (platform_id);
 504     key.encodingID.set (encoding_id);
 505 
 506     /* Note: We can use bsearch, but since it has no performance
 507      * implications, we use lsearch and as such accept fonts with
 508      * unsorted subtable list. */
 509     int result = encodingRecord./*bsearch*/lsearch (key);
 510     if (result == -1 || !encodingRecord[result].subtable)
 511       return nullptr;
 512 
 513     return &(this+encodingRecord[result].subtable);
 514   }
 515 
 516   inline bool sanitize (hb_sanitize_context_t *c) const
 517   {
 518     TRACE_SANITIZE (this);
 519     return_trace (c->check_struct (this) &&
 520                   likely (version == 0) &&
 521                   encodingRecord.sanitize (c, this));
 522   }
 523 
 524   USHORT                version;        /* Table version number (0). */
 525   SortedArrayOf<EncodingRecord>
 526                         encodingRecord; /* Encoding tables. */
 527   public:
 528   DEFINE_SIZE_ARRAY (4, encodingRecord);
 529 };
 530 
 531 
< prev index next >