Class: Fontisan::Woff2Font
- Inherits:
-
Object
- Object
- Fontisan::Woff2Font
- Defined in:
- lib/fontisan/woff2_font.rb
Overview
Web Open Font Format 2.0 (WOFF2) font loader
This class manages WOFF2 font files and provides access to decompressed tables and transformed data.
Defined Under Namespace
Classes: IOSource
Instance Attribute Summary collapse
-
#decompressed_tables ⇒ Object
Returns the value of attribute decompressed_tables.
-
#header ⇒ Object
Returns the value of attribute header.
-
#io_source ⇒ Object
Returns the value of attribute io_source.
-
#parsed_tables ⇒ Object
Returns the value of attribute parsed_tables.
-
#table_entries ⇒ Object
Returns the value of attribute table_entries.
-
#underlying_font ⇒ Object
Allow both reading and setting for table delegation.
Class Method Summary collapse
-
.apply_transformations!(table_entries, decompressed_tables) ⇒ void
Apply table transformations for glyf/loca/hmtx tables.
-
.build_sfnt_in_memory(header, table_entries, decompressed_tables) ⇒ String
Build SFNT binary structure in memory.
-
.calculate_table_directory_size(table_entries) ⇒ Integer
Calculate size of table directory.
-
.decompress_tables(io, header, table_entries) ⇒ Hash<String, String>
Decompress tables from WOFF2 compressed data block.
-
.from_file(path, mode: LoadingModes::FULL, lazy: false) ⇒ Woff2Font
Read WOFF2 font from a file and return Woff2Font instance.
-
.read_table_directory_from_io(io, header) ⇒ Array<Woff2TableDirectoryEntry>
Read table directory from IO.
-
.read_uint_base128_from_io(io) ⇒ Integer
Read variable-length UIntBase128 integer from IO.
-
.uint_base128_size(value) ⇒ Integer
Estimate size of UIntBase128 encoded value.
-
.update_checksum_in_memory(sfnt_data, table_records) ⇒ void
Update checksumAdjustment field in head table in memory.
Instance Method Summary collapse
-
#cff? ⇒ Boolean
Check if font has CFF flavor.
-
#family_name ⇒ Object
Get font family name.
-
#find_table_entry(tag) ⇒ Object
Find table entry by tag.
-
#full_name ⇒ Object
Get full font name.
-
#has_table?(tag) ⇒ Boolean
Check if table exists.
-
#initialize ⇒ Woff2Font
constructor
A new instance of Woff2Font.
-
#initialize_storage ⇒ Object
Initialize storage hashes.
-
#metadata ⇒ Object
Get metadata (if present).
-
#post_script_name ⇒ Object
Get PostScript name.
-
#preferred_family_name ⇒ Object
Get preferred family name.
-
#preferred_subfamily_name ⇒ Object
Get preferred subfamily name.
-
#subfamily_name ⇒ Object
Get font subfamily name.
-
#table(tag) ⇒ Object
Get parsed table object.
-
#table_data(tag) ⇒ Object
Get decompressed table data.
-
#table_names ⇒ Object
Get list of table tags.
-
#to_otf(output_path) ⇒ Object
Convert to OTF.
-
#to_ttf(output_path) ⇒ Object
Convert to TTF.
-
#truetype? ⇒ Boolean
Check if font has TrueType flavor.
-
#units_per_em ⇒ Object
Get units per em.
-
#valid? ⇒ Boolean
Check if font is valid.
-
#validate_signature! ⇒ Object
Validate WOFF2 signature.
-
#variable_font? ⇒ Boolean
Check if font is a variable font.
Constructor Details
#initialize ⇒ Woff2Font
Returns a new instance of Woff2Font.
91 92 93 94 95 96 97 98 |
# File 'lib/fontisan/woff2_font.rb', line 91 def initialize @header = nil @table_entries = [] @decompressed_tables = {} @parsed_tables = {} @io_source = nil @underlying_font = nil # Store the actual TrueTypeFont/OpenTypeFont end |
Instance Attribute Details
#decompressed_tables ⇒ Object
Returns the value of attribute decompressed_tables.
88 89 90 |
# File 'lib/fontisan/woff2_font.rb', line 88 def decompressed_tables @decompressed_tables end |
#header ⇒ Object
Returns the value of attribute header.
88 89 90 |
# File 'lib/fontisan/woff2_font.rb', line 88 def header @header end |
#io_source ⇒ Object
Returns the value of attribute io_source.
88 89 90 |
# File 'lib/fontisan/woff2_font.rb', line 88 def io_source @io_source end |
#parsed_tables ⇒ Object
Returns the value of attribute parsed_tables.
88 89 90 |
# File 'lib/fontisan/woff2_font.rb', line 88 def parsed_tables @parsed_tables end |
#table_entries ⇒ Object
Returns the value of attribute table_entries.
88 89 90 |
# File 'lib/fontisan/woff2_font.rb', line 88 def table_entries @table_entries end |
#underlying_font ⇒ Object
Allow both reading and setting for table delegation
89 90 91 |
# File 'lib/fontisan/woff2_font.rb', line 89 def @underlying_font end |
Class Method Details
.apply_transformations!(table_entries, decompressed_tables) ⇒ void
This method returns an undefined value.
Apply table transformations for glyf/loca/hmtx tables
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
# File 'lib/fontisan/woff2_font.rb', line 482 def self.apply_transformations!(table_entries, decompressed_tables) # Find entries that need transformation glyf_entry = table_entries.find { |e| e.tag == "glyf" } hmtx_entry = table_entries.find { |e| e.tag == "hmtx" } # Get required metadata for transformations maxp_data = decompressed_tables["maxp"] hhea_data = decompressed_tables["hhea"] return unless maxp_data && hhea_data # Parse num_glyphs from maxp table # maxp format: version(4) + numGlyphs(2) + ... num_glyphs = maxp_data[4, 2].unpack1("n") # Parse numberOfHMetrics from hhea table # hhea format: ... + numberOfHMetrics(2) at offset 34 number_of_h_metrics = hhea_data[34, 2].unpack1("n") # Check if this is a variable font by checking for fvar table variable_font = table_entries.any? { |e| e.tag == "fvar" } # Transform glyf/loca if needed # transform_length is only set when table is actually transformed # Check that transform_length exists and is greater than 0 if glyf_entry&.instance_variable_defined?(:@transform_length) && glyf_entry.transform_length&.positive? transformed_glyf = decompressed_tables["glyf"] if transformed_glyf result = Woff2::GlyfTransformer.reconstruct( transformed_glyf, num_glyphs, variable_font: variable_font ) decompressed_tables["glyf"] = result[:glyf] decompressed_tables["loca"] = result[:loca] end end # Transform hmtx if needed # transform_length is only set when table is actually transformed # Check that transform_length exists and is greater than 0 if hmtx_entry&.instance_variable_defined?(:@transform_length) && hmtx_entry.transform_length&.positive? transformed_hmtx = decompressed_tables["hmtx"] if transformed_hmtx decompressed_tables["hmtx"] = Woff2::HmtxTransformer.reconstruct( transformed_hmtx, num_glyphs, number_of_h_metrics, ) end end end |
.build_sfnt_in_memory(header, table_entries, decompressed_tables) ⇒ String
Build SFNT binary structure in memory
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/fontisan/woff2_font.rb', line 588 def self.build_sfnt_in_memory(header, table_entries, decompressed_tables) sfnt_data = +"" # Calculate offset table fields num_tables = table_entries.length entry_selector = (Math.log(num_tables) / Math.log(2)).floor search_range = (2**entry_selector) * 16 range_shift = num_tables * 16 - search_range # Write offset table sfnt_data << [header.flavor].pack("N") sfnt_data << [num_tables].pack("n") sfnt_data << [search_range].pack("n") sfnt_data << [entry_selector].pack("n") sfnt_data << [range_shift].pack("n") # Calculate table offsets offset = 12 + (num_tables * 16) # Header + directory table_records = [] table_entries.each do |entry| tag = entry.tag data = decompressed_tables[tag] next unless data length = data.bytesize # Calculate checksum checksum = Utilities::ChecksumCalculator.calculate_table_checksum(data) table_records << { tag: tag, checksum: checksum, offset: offset, length: length, data: data, } # Update offset for next table (with padding) offset += length padding = (Constants::TABLE_ALIGNMENT - (length % Constants::TABLE_ALIGNMENT)) % Constants::TABLE_ALIGNMENT offset += padding end # Write table directory table_records.each do |record| sfnt_data << record[:tag].ljust(4, "\x00") sfnt_data << [record[:checksum]].pack("N") sfnt_data << [record[:offset]].pack("N") sfnt_data << [record[:length]].pack("N") end # Write table data with padding table_records.each do |record| sfnt_data << record[:data] # Add padding padding = (Constants::TABLE_ALIGNMENT - (record[:length] % Constants::TABLE_ALIGNMENT)) % Constants::TABLE_ALIGNMENT sfnt_data << ("\x00" * padding) if padding.positive? end # Update checksumAdjustment in head table update_checksum_in_memory(sfnt_data, table_records) sfnt_data end |
.calculate_table_directory_size(table_entries) ⇒ Integer
Calculate size of table directory
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'lib/fontisan/woff2_font.rb', line 543 def self.calculate_table_directory_size(table_entries) size = 0 table_entries.each do |entry| size += 1 # flags byte # Tag (4 bytes if custom, 0 if known) tag_index = entry.flags & 0x3F size += 4 if tag_index == 0x3F # orig_length (UIntBase128) - estimate size += uint_base128_size(entry.orig_length) # transform_length if present if entry.transform_version && !entry.transform_version.nil? size += uint_base128_size(entry.transform_length) end end size end |
.decompress_tables(io, header, table_entries) ⇒ Hash<String, String>
Decompress tables from WOFF2 compressed data block
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/fontisan/woff2_font.rb', line 454 def self.decompress_tables(io, header, table_entries) # IO stream is already positioned at compressed data after reading table directory # No need to seek - just read from current position compressed_data = io.read(header.total_compressed_size) # Decompress entire data block with Brotli decompressed_data = Brotli.inflate(compressed_data) # Split decompressed data into individual tables decompressed_tables = {} offset = 0 table_entries.each do |entry| table_size = entry.transform_length || entry.orig_length table_data = decompressed_data[offset, table_size] offset += table_size decompressed_tables[entry.tag] = table_data end decompressed_tables end |
.from_file(path, mode: LoadingModes::FULL, lazy: false) ⇒ Woff2Font
Read WOFF2 font from a file and return Woff2Font instance
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/fontisan/woff2_font.rb', line 289 def self.from_file(path, mode: LoadingModes::FULL, lazy: false) if path.nil? || path.to_s.empty? raise ArgumentError, "path cannot be nil or empty" end raise Errno::ENOENT, "File not found: #{path}" unless File.exist?(path) woff2 = new woff2.io_source = IOSource.new(path) File.open(path, "rb") do |io| # Read header to determine font flavor woff2.header = Woff2::Woff2Header.read(io) # Validate signature unless woff2.header.signature == Woff2::Woff2Header::SIGNATURE raise InvalidFontError, "Invalid WOFF2 signature: expected 0x#{Woff2::Woff2Header::SIGNATURE.to_s(16)}, " \ "got 0x#{woff2.header.signature.to_i.to_s(16)}" end # Read table directory woff2.table_entries = read_table_directory_from_io(io, woff2.header) # Decompress table data woff2.decompressed_tables = decompress_tables(io, woff2.header, woff2.table_entries) # Apply table transformations if present apply_transformations!(woff2.table_entries, woff2.decompressed_tables) # Build SFNT structure in memory sfnt_data = build_sfnt_in_memory(woff2.header, woff2.table_entries, woff2.decompressed_tables) # Create StringIO for reading sfnt_io = StringIO.new(sfnt_data) sfnt_io.rewind # Parse tables based on font type if woff2.truetype? font = TrueTypeFont.read(sfnt_io) font.initialize_storage font.loading_mode = mode font.lazy_load_enabled = lazy # Create fresh StringIO for table data reading table_io = StringIO.new(sfnt_data) font.read_table_data(table_io) # Store underlying font for table access delegation woff2. = font woff2.parsed_tables = font.parsed_tables elsif woff2.cff? font = OpenTypeFont.read(sfnt_io) font.initialize_storage font.loading_mode = mode font.lazy_load_enabled = lazy # Create fresh StringIO for table data reading table_io = StringIO.new(sfnt_data) font.read_table_data(table_io) # Store underlying font for table access delegation woff2. = font woff2.parsed_tables = font.parsed_tables else raise InvalidFontError, "Unknown WOFF2 flavor: 0x#{woff2.header.flavor.to_s(16)}" end end woff2 rescue BinData::ValidityError, EOFError => e raise InvalidFontError, "Invalid WOFF2 file: #{e.}" end |
.read_table_directory_from_io(io, header) ⇒ Array<Woff2TableDirectoryEntry>
Read table directory from IO
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/fontisan/woff2_font.rb', line 368 def self.read_table_directory_from_io(io, header) table_entries = [] header.num_tables.times do entry = Woff2TableDirectoryEntry.new # Read flags byte with nil check flags_data = io.read(1) raise EOFError, "Unexpected EOF while reading table directory flags" if flags_data.nil? flags = flags_data.unpack1("C") entry.flags = flags # Determine tag tag_index = flags & 0x3F if tag_index == 0x3F # Custom tag (4 bytes) tag_data = io.read(4) raise EOFError, "Unexpected EOF while reading custom tag" if tag_data.nil? || tag_data.bytesize < 4 entry.tag = tag_data.force_encoding("UTF-8") else # Known tag from table entry.tag = Woff2TableDirectoryEntry::KNOWN_TAGS[tag_index] unless entry.tag raise InvalidFontError, "Invalid table tag index: #{tag_index}" end end # Read orig_length (UIntBase128) entry.orig_length = read_uint_base128_from_io(io) # Determine if transformLength should be read # According to WOFF2 spec section 4.2: # - glyf/loca with version 0: TRANSFORMED (transformLength present) # - hmtx with non-zero version: TRANSFORMED (transformLength present) # - all other tables: transformation version is 0 (no transformLength) transform_version = (flags >> 6) & 0x03 has_transform_length = if ["glyf", "loca"].include?(entry.tag) && transform_version.zero? true elsif entry.tag == "hmtx" && transform_version != 0 true else false end if has_transform_length entry.transform_length = read_uint_base128_from_io(io) entry.transform_version = transform_version end table_entries << entry end table_entries end |
.read_uint_base128_from_io(io) ⇒ Integer
Read variable-length UIntBase128 integer from IO
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/fontisan/woff2_font.rb', line 428 def self.read_uint_base128_from_io(io) result = 0 5.times do byte_data = io.read(1) raise EOFError, "Unexpected EOF while reading UIntBase128" if byte_data.nil? byte = byte_data.unpack1("C") # Continue if high bit is set if (byte & 0x80).zero? return (result << 7) | byte else result = (result << 7) | (byte & 0x7F) end end # If we're here, the encoding is invalid raise InvalidFontError, "Invalid UIntBase128 encoding" end |
.uint_base128_size(value) ⇒ Integer
Estimate size of UIntBase128 encoded value
567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
# File 'lib/fontisan/woff2_font.rb', line 567 def self.uint_base128_size(value) return 1 if value < 128 bytes = 0 v = value while v.positive? bytes += 1 v >>= 7 end [ bytes, 5, ].min # Max 5 bytes end |
.update_checksum_in_memory(sfnt_data, table_records) ⇒ void
This method returns an undefined value.
Update checksumAdjustment field in head table in memory
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
# File 'lib/fontisan/woff2_font.rb', line 662 def self.update_checksum_in_memory(sfnt_data, table_records) # Find head table record head_record = table_records.find { |r| r[:tag] == Constants::HEAD_TAG } return unless head_record # Zero out checksumAdjustment field first head_offset = head_record[:offset] sfnt_data[head_offset + 8, 4] = "\x00\x00\x00\x00" # Calculate file checksum checksum = 0 sfnt_data.bytes.each_slice(4) do |bytes| word = bytes.pack("C*").ljust(4, "\x00").unpack1("N") checksum = (checksum + word) & 0xFFFFFFFF end # Calculate adjustment adjustment = (0xB1B0AFBA - checksum) & 0xFFFFFFFF # Write adjustment to head table sfnt_data[head_offset + 8, 4] = [adjustment].pack("N") end |
Instance Method Details
#cff? ⇒ Boolean
Check if font has CFF flavor
114 115 116 117 118 |
# File 'lib/fontisan/woff2_font.rb', line 114 def cff? return false unless @header [Constants::SFNT_VERSION_OTTO, 0x4F54544F].include?(@header.flavor) end |
#family_name ⇒ Object
Get font family name
239 240 241 242 |
# File 'lib/fontisan/woff2_font.rb', line 239 def family_name name_table = table("name") name_table&.english_name(Tables::Name::FAMILY) end |
#find_table_entry(tag) ⇒ Object
Find table entry by tag
150 151 152 |
# File 'lib/fontisan/woff2_font.rb', line 150 def find_table_entry(tag) @table_entries.find { |entry| entry.tag == tag } end |
#full_name ⇒ Object
Get full font name
251 252 253 254 |
# File 'lib/fontisan/woff2_font.rb', line 251 def full_name name_table = table("name") name_table&.english_name(Tables::Name::FULL_NAME) end |
#has_table?(tag) ⇒ Boolean
Check if table exists
145 146 147 |
# File 'lib/fontisan/woff2_font.rb', line 145 def has_table?(tag) @table_entries.any? { |entry| entry.tag == tag } end |
#initialize_storage ⇒ Object
Initialize storage hashes
101 102 103 104 |
# File 'lib/fontisan/woff2_font.rb', line 101 def initialize_storage @decompressed_tables ||= {} @initialize_storage ||= {} end |
#metadata ⇒ Object
Get metadata (if present)
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/fontisan/woff2_font.rb', line 220 def return nil unless @header&.&.positive? return nil unless @io_source begin File.open(@io_source.path, "rb") do |io| io.seek(@header.) = io.read(@header.) Brotli.inflate() end rescue StandardError => e warn "Failed to decompress metadata: #{e.}" nil end end |
#post_script_name ⇒ Object
Get PostScript name
257 258 259 260 |
# File 'lib/fontisan/woff2_font.rb', line 257 def post_script_name name_table = table("name") name_table&.english_name(Tables::Name::POSTSCRIPT_NAME) end |
#preferred_family_name ⇒ Object
Get preferred family name
263 264 265 266 |
# File 'lib/fontisan/woff2_font.rb', line 263 def preferred_family_name name_table = table("name") name_table&.english_name(Tables::Name::PREFERRED_FAMILY) end |
#preferred_subfamily_name ⇒ Object
Get preferred subfamily name
269 270 271 272 |
# File 'lib/fontisan/woff2_font.rb', line 269 def preferred_subfamily_name name_table = table("name") name_table&.english_name(Tables::Name::PREFERRED_SUBFAMILY) end |
#subfamily_name ⇒ Object
Get font subfamily name
245 246 247 248 |
# File 'lib/fontisan/woff2_font.rb', line 245 def subfamily_name name_table = table("name") name_table&.english_name(Tables::Name::SUBFAMILY) end |
#table(tag) ⇒ Object
Get parsed table object
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/fontisan/woff2_font.rb', line 172 def table(tag) # Delegate to underlying font if available return @underlying_font.table(tag) if @underlying_font # Fallback to parsed_tables hash # Normalize tag to UTF-8 string for hash lookup # Use dup to create mutable copy since force_encoding modifies in place tag_key = tag.to_s.dup.force_encoding("UTF-8") @parsed_tables[tag_key] end |
#table_data(tag) ⇒ Object
Get decompressed table data
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/fontisan/woff2_font.rb', line 160 def table_data(tag) # First try underlying font's table data if available if @underlying_font && @underlying_font.respond_to?(:table_data) = @underlying_font.table_data[tag] return if end # Fallback to decompressed_tables @decompressed_tables[tag] end |
#table_names ⇒ Object
Get list of table tags
155 156 157 |
# File 'lib/fontisan/woff2_font.rb', line 155 def table_names @table_entries.map(&:tag) end |
#to_otf(output_path) ⇒ Object
Convert to OTF
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/fontisan/woff2_font.rb', line 202 def to_otf(output_path) unless cff? raise InvalidFontError, "Cannot convert to OTF: font is not CFF flavored" end # Build SFNT and create OpenTypeFont sfnt_data = self.class.build_sfnt_in_memory(@header, @table_entries, @decompressed_tables) sfnt_io = StringIO.new(sfnt_data) # Create actual OpenTypeFont and save for table delegation @underlying_font = OpenTypeFont.read(sfnt_io) @underlying_font.initialize_storage @underlying_font.read_table_data(sfnt_io) FontWriter.write_to_file(@underlying_font.tables, output_path) end |
#to_ttf(output_path) ⇒ Object
Convert to TTF
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/fontisan/woff2_font.rb', line 184 def to_ttf(output_path) unless truetype? raise InvalidFontError, "Cannot convert to TTF: font is not TrueType flavored" end # Build SFNT and create TrueTypeFont sfnt_data = self.class.build_sfnt_in_memory(@header, @table_entries, @decompressed_tables) sfnt_io = StringIO.new(sfnt_data) # Create actual TrueTypeFont and save for table delegation @underlying_font = TrueTypeFont.read(sfnt_io) @underlying_font.initialize_storage @underlying_font.read_table_data(sfnt_io) FontWriter.write_to_file(@underlying_font.tables, output_path) end |
#truetype? ⇒ Boolean
Check if font has TrueType flavor
107 108 109 110 111 |
# File 'lib/fontisan/woff2_font.rb', line 107 def truetype? return false unless @header [Constants::SFNT_VERSION_TRUETYPE, 0x00010000].include?(@header.flavor) end |
#units_per_em ⇒ Object
Get units per em
275 276 277 278 |
# File 'lib/fontisan/woff2_font.rb', line 275 def units_per_em head = table("head") head&.units_per_em end |
#valid? ⇒ Boolean
Check if font is valid
135 136 137 138 139 140 141 142 |
# File 'lib/fontisan/woff2_font.rb', line 135 def valid? return false unless @header return false unless @header.signature == Woff2::Woff2Header::SIGNATURE return false unless @header.num_tables == @table_entries.length return false unless has_table?("head") true end |
#validate_signature! ⇒ Object
Validate WOFF2 signature
128 129 130 131 132 |
# File 'lib/fontisan/woff2_font.rb', line 128 def validate_signature! unless @header && @header.signature == Woff2::Woff2Header::SIGNATURE raise InvalidFontError, "Invalid WOFF2 signature" end end |
#variable_font? ⇒ Boolean
Check if font is a variable font
123 124 125 |
# File 'lib/fontisan/woff2_font.rb', line 123 def variable_font? has_table?("fvar") end |