Class: Fontisan::Tables::CompoundGlyph::Component

Inherits:
Struct
  • Object
show all
Defined in:
lib/fontisan/tables/glyf/compound_glyph.rb

Overview

Component data structure

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arg1Object

Returns the value of attribute arg1

Returns:

  • (Object)

    the current value of arg1



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def arg1
  @arg1
end

#arg2Object

Returns the value of attribute arg2

Returns:

  • (Object)

    the current value of arg2



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def arg2
  @arg2
end

#flagsObject

Returns the value of attribute flags

Returns:

  • (Object)

    the current value of flags



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def flags
  @flags
end

#glyph_indexObject

Returns the value of attribute glyph_index

Returns:

  • (Object)

    the current value of glyph_index



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def glyph_index
  @glyph_index
end

#scale_01Object

Returns the value of attribute scale_01

Returns:

  • (Object)

    the current value of scale_01



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def scale_01
  @scale_01
end

#scale_10Object

Returns the value of attribute scale_10

Returns:

  • (Object)

    the current value of scale_10



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def scale_10
  @scale_10
end

#scale_xObject

Returns the value of attribute scale_x

Returns:

  • (Object)

    the current value of scale_x



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def scale_x
  @scale_x
end

#scale_yObject

Returns the value of attribute scale_y

Returns:

  • (Object)

    the current value of scale_y



55
56
57
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 55

def scale_y
  @scale_y
end

Instance Method Details

#args_are_xy?Boolean

Check if arguments are x,y offsets (vs point numbers)

Returns:

  • (Boolean)


66
67
68
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 66

def args_are_xy?
  (flags & ARGS_ARE_XY_VALUES) != 0
end

#has_2x2?Boolean

Check if component has 2x2 transformation matrix

Returns:

  • (Boolean)


86
87
88
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 86

def has_2x2?
  (flags & WE_HAVE_A_TWO_BY_TWO) != 0
end

#has_scale?Boolean

Check if component has uniform scale

Returns:

  • (Boolean)


76
77
78
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 76

def has_scale?
  (flags & WE_HAVE_A_SCALE) != 0
end

#has_xy_scale?Boolean

Check if component has separate x,y scale

Returns:

  • (Boolean)


81
82
83
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 81

def has_xy_scale?
  (flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0
end

#overlap?Boolean

Check if component overlaps with others

Returns:

  • (Boolean)


91
92
93
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 91

def overlap?
  (flags & OVERLAP_COMPOUND) != 0
end

#transformation_matrixArray<Float>

Get transformation matrix as array [a, b, c, d, e, f] representing affine transformation: x' = ax + cy + e, y' = bx + dy + f

Returns:

  • (Array<Float>)

    Transformation matrix [a, b, c, d, e, f]



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 99

def transformation_matrix
  if has_2x2?
    [scale_x, scale_01, scale_10, scale_y, arg1, arg2]
  elsif has_xy_scale?
    [scale_x, 0.0, 0.0, scale_y, arg1, arg2]
  elsif has_scale?
    [scale_x, 0.0, 0.0, scale_x, arg1, arg2]
  else
    [1.0, 0.0, 0.0, 1.0, arg1, arg2]
  end
end

#use_my_metrics?Boolean

Check if using this component's metrics

Returns:

  • (Boolean)


71
72
73
# File 'lib/fontisan/tables/glyf/compound_glyph.rb', line 71

def use_my_metrics?
  (flags & USE_MY_METRICS) != 0
end