Class: Fontisan::Models::SvgGlyph
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::SvgGlyph
- Defined in:
- lib/fontisan/models/svg_glyph.rb
Overview
SVG glyph representation model
Represents an SVG document for a glyph or range of glyphs from the SVG table. Each SVG document can cover multiple glyph IDs and may be compressed.
This model uses lutaml-model for structured serialization to YAML/JSON/XML.
Instance Attribute Summary collapse
-
#compressed ⇒ Boolean
Whether the original data was gzip compressed.
-
#end_glyph_id ⇒ Integer
Last glyph ID in range covered by this SVG.
-
#glyph_id ⇒ Integer
Primary glyph ID (usually same as start_glyph_id).
-
#start_glyph_id ⇒ Integer
First glyph ID in range covered by this SVG.
-
#svg_content ⇒ String
SVG XML content (decompressed).
Instance Method Summary collapse
-
#covers_multiple_glyphs? ⇒ Boolean
Check if this SVG covers multiple glyphs.
-
#glyph_range ⇒ Range
Get glyph IDs covered by this SVG document.
-
#has_content? ⇒ Boolean
Check if SVG content is present.
-
#includes_glyph?(glyph_id) ⇒ Boolean
Check if this SVG covers a specific glyph ID.
-
#num_glyphs ⇒ Integer
Get the number of glyphs covered by this SVG.
Instance Attribute Details
#compressed ⇒ Boolean
Returns Whether the original data was gzip compressed.
50 |
# File 'lib/fontisan/models/svg_glyph.rb', line 50 attribute :compressed, :boolean, default: -> { false } |
#end_glyph_id ⇒ Integer
Returns Last glyph ID in range covered by this SVG.
42 |
# File 'lib/fontisan/models/svg_glyph.rb', line 42 attribute :end_glyph_id, :integer |
#glyph_id ⇒ Integer
Returns Primary glyph ID (usually same as start_glyph_id).
34 |
# File 'lib/fontisan/models/svg_glyph.rb', line 34 attribute :glyph_id, :integer |
#start_glyph_id ⇒ Integer
Returns First glyph ID in range covered by this SVG.
38 |
# File 'lib/fontisan/models/svg_glyph.rb', line 38 attribute :start_glyph_id, :integer |
#svg_content ⇒ String
Returns SVG XML content (decompressed).
46 |
# File 'lib/fontisan/models/svg_glyph.rb', line 46 attribute :svg_content, :string |
Instance Method Details
#covers_multiple_glyphs? ⇒ Boolean
Check if this SVG covers multiple glyphs
70 71 72 |
# File 'lib/fontisan/models/svg_glyph.rb', line 70 def covers_multiple_glyphs? start_glyph_id != end_glyph_id end |
#glyph_range ⇒ Range
Get glyph IDs covered by this SVG document
55 56 57 |
# File 'lib/fontisan/models/svg_glyph.rb', line 55 def glyph_range start_glyph_id..end_glyph_id end |
#has_content? ⇒ Boolean
Check if SVG content is present
84 85 86 |
# File 'lib/fontisan/models/svg_glyph.rb', line 84 def has_content? !svg_content.nil? && !svg_content.empty? end |
#includes_glyph?(glyph_id) ⇒ Boolean
Check if this SVG covers a specific glyph ID
63 64 65 |
# File 'lib/fontisan/models/svg_glyph.rb', line 63 def includes_glyph?(glyph_id) glyph_range.include?(glyph_id) end |
#num_glyphs ⇒ Integer
Get the number of glyphs covered by this SVG
77 78 79 |
# File 'lib/fontisan/models/svg_glyph.rb', line 77 def num_glyphs end_glyph_id - start_glyph_id + 1 end |