class

Hpdf::Font

Inherits Hpdf::Helper / Reference / Object

Constructors

new(font : LibHaru::Font, doc : Doc)
Source

Instance methods

ascent(font_size : Number) : Float32

the vertical ascent of the font in points calculated based on the given font_size.

  • font_size the size to calculate the height with.
Source
ascent

the vertical ascent of the font in UPM (units per eM).

Source
b_box

the bounding box of the font.

Source
cap_height(font_size : Number) : Float32

the distance from the baseline of uppercase letters in points calculated based on the given font_size.

  • font_size the size to calculate the height with.
Source
cap_height

the distance from the baseline of uppercase letters in UPM (units per eM).

Source
descent(font_size : Number) : Float32

the vertical descent of the font in points calculated based on the given font_size.

  • font_size the size to calculate the height with.
Source
descent

the vertical descent of the font in UPM (units per eM).

Source
encoding_name

the encoding name of the font.

Source
measure_text(text : String | Bytes, *, width : Number, font_size : Number, char_space : Number, word_space : Number, word_wrap : Bool = true) : MeasuredText

calculates the byte length which can be included within the specified width.

  • width The width of the area to put the text.
  • font_size The size of the font.
  • char_space The character spacing.
  • word_space The word spacing.
  • word_wrap When there are three words of "ABCDE FGH IJKL", and the substring until "J" can be included within the width, if word_wrap parameter is false it returns 12, and if word_wrap parameter is false word_wrap parameter is false it returns 10 (the end of the previous word).
Source
name

the name of the font.

Source
text_width(text : String | Bytes)

total width of the text, number of charactors and number of the words.

Source
to_unsafe
Source
unicode_width(char : UInt16) : Int32

the width of a charactor in the font.

Source
x_height(font_size : Number) : Float32

the distance from the baseline of lowercase letters in points calculated based on the given font_size.

  • font_size the size to calculate the height with.
Source
x_height

the distance from the baseline of lowercase letters in UPM (units per eM).

Source