Class: Fontisan::Subset::TableStrategy::Cmap
- Inherits:
-
Object
- Object
- Fontisan::Subset::TableStrategy::Cmap
- Defined in:
- lib/fontisan/subset/table_strategy/cmap.rb
Overview
Cmap strategy: rebuild cmap containing only the (codepoint → new GID) mappings for codepoints whose original GID is retained. Emits a format-4 subtable for BMP codepoints and a format-12 subtable for supplementary-plane codepoints.
Defined Under Namespace
Classes: Builder
Class Method Summary collapse
-
.call(context:, tag:, table:) ⇒ String
Binary cmap bytes for the subset.
Class Method Details
.call(context:, tag:, table:) ⇒ String
Returns binary cmap bytes for the subset.
15 16 17 18 19 20 21 22 |
# File 'lib/fontisan/subset/table_strategy/cmap.rb', line 15 def self.call(context:, tag:, table:) new_mappings = {} table.unicode_mappings.each do |char_code, old_gid| new_gid = context.mapping.new_id(old_gid) new_mappings[char_code] = new_gid if new_gid end Builder.new(new_mappings).build end |