pub struct FontMetrics { /* private fields */ }
Expand description
A FontMetrics
structure holds the overall metric information
for a font.
The information in a FontMetrics
structure may be restricted
to a script. The fields of this structure are private to implementations
of a font backend. See the documentation of the corresponding getters
for documentation of their meaning.
For an overview of the most important metrics, see:
GLib type: Shared boxed type with reference counted clone semantics.
Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn as_ptr(&self) -> *mut PangoFontMetrics
pub fn as_ptr(&self) -> *mut PangoFontMetrics
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut PangoFontMetrics) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut PangoFontMetrics) -> &Self
Borrows the underlying C value.
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn approximate_char_width(&self) -> i32
pub fn approximate_char_width(&self) -> i32
Gets the approximate character width for a font metrics structure.
This is merely a representative value useful, for example, for determining the initial size for a window. Actual characters in text will be wider and narrower than this.
§Returns
the character width, in Pango units.
Sourcepub fn approximate_digit_width(&self) -> i32
pub fn approximate_digit_width(&self) -> i32
Gets the approximate digit width for a font metrics structure.
This is merely a representative value useful, for example, for determining the initial size for a window. Actual digits in text can be wider or narrower than this, though this value is generally somewhat more accurate than the result of pango_font_metrics_get_approximate_char_width() for digits.
§Returns
the digit width, in Pango units.
Sourcepub fn ascent(&self) -> i32
pub fn ascent(&self) -> i32
Gets the ascent from a font metrics structure.
The ascent is the distance from the baseline to the logical top of a line of text. (The logical top may be above or below the top of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)
§Returns
the ascent, in Pango units.
Sourcepub fn descent(&self) -> i32
pub fn descent(&self) -> i32
Gets the descent from a font metrics structure.
The descent is the distance from the baseline to the logical bottom of a line of text. (The logical bottom may be above or below the bottom of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)
§Returns
the descent, in Pango units.
Sourcepub fn height(&self) -> i32
Available on crate feature v1_44
only.
pub fn height(&self) -> i32
v1_44
only.Gets the line height from a font metrics structure.
The line height is the recommended distance between successive baselines in wrapped text using this font.
If the line height is not available, 0 is returned.
§Returns
the height, in Pango units
Sourcepub fn strikethrough_position(&self) -> i32
pub fn strikethrough_position(&self) -> i32
Gets the suggested position to draw the strikethrough.
The value returned is the distance above the baseline of the top of the strikethrough.
§Returns
the suggested strikethrough position, in Pango units.
Sourcepub fn strikethrough_thickness(&self) -> i32
pub fn strikethrough_thickness(&self) -> i32
Gets the suggested thickness to draw for the strikethrough.
§Returns
the suggested strikethrough thickness, in Pango units.
Sourcepub fn underline_position(&self) -> i32
pub fn underline_position(&self) -> i32
Gets the suggested position to draw the underline.
The value returned is the distance above the baseline of the top of the underline. Since most fonts have underline positions beneath the baseline, this value is typically negative.
§Returns
the suggested underline position, in Pango units.
Sourcepub fn underline_thickness(&self) -> i32
pub fn underline_thickness(&self) -> i32
Gets the suggested thickness to draw for the underline.
§Returns
the suggested underline thickness, in Pango units.
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§impl Debug for FontMetrics
impl Debug for FontMetrics
Source§impl From<FontMetrics> for Value
impl From<FontMetrics> for Value
Source§fn from(s: FontMetrics) -> Self
fn from(s: FontMetrics) -> Self
Source§impl HasParamSpec for FontMetrics
impl HasParamSpec for FontMetrics
type ParamSpec = ParamSpecBoxed
Source§type SetValue = FontMetrics
type SetValue = FontMetrics
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, FontMetrics>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for FontMetrics
impl Hash for FontMetrics
Source§impl Ord for FontMetrics
impl Ord for FontMetrics
Source§fn cmp(&self, other: &FontMetrics) -> Ordering
fn cmp(&self, other: &FontMetrics) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FontMetrics
impl PartialEq for FontMetrics
Source§impl PartialOrd for FontMetrics
impl PartialOrd for FontMetrics
Source§impl StaticType for FontMetrics
impl StaticType for FontMetrics
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for FontMetrics
impl StructuralPartialEq for FontMetrics
Auto Trait Implementations§
impl Freeze for FontMetrics
impl RefUnwindSafe for FontMetrics
impl !Send for FontMetrics
impl !Sync for FontMetrics
impl Unpin for FontMetrics
impl UnwindSafe for FontMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)