Hpdf::Font
Inherits Hpdf::Helper / Reference / Object
Constructors
new(font : LibHaru::Font, doc : Doc)
SourceInstance 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.
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.
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.
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 isfalseit returns12, and if word_wrap parameter isfalseword_wrap parameter isfalseit returns10(the end of the previous word).
text_width(text : String | Bytes)
total width of the text, number of charactors and number of the words.
to_unsafe
Sourcex_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.