Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. Type Name Description
  2. uint32 scaler type A tag to indicate the OFA scaler to be used to rasterize this font; see the note on the scaler type below for more information.
  3. uint16 numTables number of tables
  4. uint16 searchRange (maximum power of 2 <= numTables)*16
  5. uint16 entrySelector log2(maximum power of 2 <= numTables)
  6. uint16 rangeShift numTables*16-searchRange
  7.  
  8. struct Offset_Subtable;
  9. {
  10. uint32 scaler_type_;
  11. uint16 numTables_;
  12. uint16 searchRange_;
  13. uint16 entrySelector_;
  14. uint16 rangeShift_;
  15.  
  16. bool is_for_macOS() { return scaler_type_ == 0x74727565; }
  17. bool is_for_windoes() { return scaler_type_ == 0x00010000; }
  18. bool is_truetype() { return scaler_type_ == 0x74727565 ||
  19. scaler_type_ == 0x00010000; }
  20. bool is_postscript() { return scaler_type_ == 0x74797031; }
  21. };
  22.  
  23. Type Name Description
  24. uint32 tag 4-byte identifier
  25. uint32 checkSum checksum for this table
  26. uint32 offset offset from beginning of sfnt
  27. uint32 length length of this table in byte (actual length not padded length)
  28.  
  29. struct Table_Directory_Entry
  30. {
  31. uint32 tag_;
  32. uint32 checkSum_;
  33. uint32 offset_;
  34. uint32 length_;
  35. };
  36.  
  37. const void* p_ttf = ...;
  38. const Offset_Subtable* p_os = static_cast<const Offset_Subtable*>(p_ttf);
  39. ... use any data you're interested in...
  40. for (int table_num = 1; table_num <= p_os->numTables_; ++table_num)
  41. {
  42. const Table_Directory_Entry* p_tde =
  43. reinterpret_cast<const Table_Directory_Entry*>(&p_os[1]);
  44. ... use the table directory entry data ...
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement