Class: Fontisan::Hints::TrueTypeHintApplier

Inherits:
Object
  • Object
show all
Defined in:
lib/fontisan/hints/truetype_hint_applier.rb

Overview

Applies rendering hints to TrueType glyph data

This applier converts universal Hint objects into TrueType bytecode instructions and integrates them into glyph data. It ensures proper instruction sequencing and maintains compatibility with TrueType instruction execution model.

Examples:

Apply hints to a glyph

applier = TrueTypeHintApplier.new
glyph_with_hints = applier.apply(glyph, hints)

Instance Method Summary collapse

Instance Method Details

#apply(glyph, hints) ⇒ Glyph

Apply hints to TrueType glyph

Parameters:

  • glyph (Glyph)

    Target glyph

  • hints (Array<Hint>)

    Hints to apply

Returns:

  • (Glyph)

    Glyph with applied hints



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fontisan/hints/truetype_hint_applier.rb', line 23

def apply(glyph, hints)
  return glyph if hints.nil? || hints.empty?
  return glyph if glyph.nil?

  # Convert hints to TrueType instructions
  instructions = build_instructions(hints)

  # Apply to glyph (this is a simplified version)
  # In a real implementation, we would need to:
  # 1. Analyze existing glyph structure
  # 2. Insert instructions at appropriate points
  # 3. Update glyph instruction data

  # For now, we just return the glyph as-is since
  # this is a complex operation requiring deep integration
  # with the glyph structure
  glyph
end