Module: HarfBuzz::OT::Metrics
- Defined in:
- lib/harfbuzz/ot/metrics.rb
Overview
OpenType Metrics API
Class Method Summary collapse
-
.position(font, tag) ⇒ Integer?
Returns a metric position value (returns nil if not available).
-
.position_with_fallback(font, tag) ⇒ Integer
Returns a metric position with fallback (always returns a value).
-
.variation(font, tag) ⇒ Float
Returns a metric float variation value.
-
.x_variation(font, tag) ⇒ Integer
Returns the X variation for a metric.
-
.y_variation(font, tag) ⇒ Integer
Returns the Y variation for a metric.
Class Method Details
.position(font, tag) ⇒ Integer?
Returns a metric position value (returns nil if not available)
13 14 15 16 17 |
# File 'lib/harfbuzz/ot/metrics.rb', line 13 def position(font, tag) pos_ptr = FFI::MemoryPointer.new(:int32) ok = C.hb_ot_metrics_get_position(font.ptr, tag, pos_ptr) ok.zero? ? nil : pos_ptr.read_int32 end |
.position_with_fallback(font, tag) ⇒ Integer
Returns a metric position with fallback (always returns a value)
23 24 25 26 27 |
# File 'lib/harfbuzz/ot/metrics.rb', line 23 def position_with_fallback(font, tag) pos_ptr = FFI::MemoryPointer.new(:int32) C.hb_ot_metrics_get_position_with_fallback(font.ptr, tag, pos_ptr) pos_ptr.read_int32 end |
.variation(font, tag) ⇒ Float
Returns a metric float variation value
33 34 35 |
# File 'lib/harfbuzz/ot/metrics.rb', line 33 def variation(font, tag) C.hb_ot_metrics_get_variation(font.ptr, tag) end |
.x_variation(font, tag) ⇒ Integer
Returns the X variation for a metric
41 42 43 |
# File 'lib/harfbuzz/ot/metrics.rb', line 41 def x_variation(font, tag) C.hb_ot_metrics_get_x_variation(font.ptr, tag) end |
.y_variation(font, tag) ⇒ Integer
Returns the Y variation for a metric
49 50 51 |
# File 'lib/harfbuzz/ot/metrics.rb', line 49 def y_variation(font, tag) C.hb_ot_metrics_get_y_variation(font.ptr, tag) end |