pango/
lib.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![doc = include_str!("../README.md")]
5
6pub use glib;
7pub use pango_sys as ffi;
8
9#[allow(clippy::too_many_arguments)]
10#[allow(clippy::derived_hash_with_manual_eq)]
11#[allow(clippy::missing_safety_doc)]
12mod auto;
13pub use crate::{auto::*, functions::*};
14
15/// The scale between dimensions used for Pango distances and device units.
16///
17/// The definition of device units is dependent on the output device; it will
18/// typically be pixels for a screen, and points for a printer. `PANGO_SCALE` is
19/// currently 1024, but this may be changed in the future.
20///
21/// When setting font sizes, device units are always considered to be
22/// points (as in "12 point font"), rather than pixels.
23#[doc(alias = "PANGO_SCALE")]
24pub const SCALE: i32 = ffi::PANGO_SCALE;
25/// Whether the segment should be shifted to center around the baseline.
26///
27/// This is mainly used in vertical writing directions.
28#[doc(alias = "PANGO_ANALYSIS_FLAG_CENTERED_BASELINE")]
29pub const ANALYSIS_FLAG_CENTERED_BASELINE: i32 = ffi::PANGO_ANALYSIS_FLAG_CENTERED_BASELINE;
30/// Whether this run holds ellipsized text.
31#[doc(alias = "PANGO_ANALYSIS_FLAG_IS_ELLIPSIS")]
32pub const ANALYSIS_FLAG_IS_ELLIPSIS: i32 = ffi::PANGO_ANALYSIS_FLAG_IS_ELLIPSIS;
33/// Whether to add a hyphen at the end of the run during shaping.
34#[doc(alias = "PANGO_ANALYSIS_FLAG_NEED_HYPHEN")]
35pub const ANALYSIS_FLAG_NEED_HYPHEN: i32 = ffi::PANGO_ANALYSIS_FLAG_NEED_HYPHEN;
36/// Value for @start_index in [`Attribute`][crate::Attribute] that indicates
37/// the beginning of the text.
38#[doc(alias = "PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING")]
39pub const ATTR_INDEX_FROM_TEXT_BEGINNING: u32 = ffi::PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
40/// Value for @end_index in [`Attribute`][crate::Attribute] that indicates
41/// the end of the text.
42#[doc(alias = "PANGO_ATTR_INDEX_TO_TEXT_END")]
43pub const ATTR_INDEX_TO_TEXT_END: u32 = ffi::PANGO_ATTR_INDEX_TO_TEXT_END;
44/// A `PangoGlyph` value that indicates a zero-width empty glpyh.
45///
46/// This is useful for example in shaper modules, to use as the glyph for
47/// various zero-width Unicode characters (those passing [`is_zero_width()`][crate::is_zero_width()]).
48#[doc(alias = "PANGO_GLYPH_EMPTY")]
49pub const GLYPH_EMPTY: Glyph = ffi::PANGO_GLYPH_EMPTY;
50/// A `PangoGlyph` value for invalid input.
51///
52/// [`Layout`][crate::Layout] produces one such glyph per invalid input UTF-8 byte and such
53/// a glyph is rendered as a crossed box.
54///
55/// Note that this value is defined such that it has the `PANGO_GLYPH_UNKNOWN_FLAG`
56/// set.
57#[doc(alias = "PANGO_GLYPH_INVALID_INPUT")]
58pub const GLYPH_INVALID_INPUT: Glyph = ffi::PANGO_GLYPH_INVALID_INPUT;
59/// Flag used in `PangoGlyph` to turn a `gunichar` value of a valid Unicode
60/// character into an unknown-character glyph for that `gunichar`.
61///
62/// Such unknown-character glyphs may be rendered as a 'hex box'.
63#[doc(alias = "PANGO_GLYPH_UNKNOWN_FLAG")]
64pub const GLYPH_UNKNOWN_FLAG: Glyph = ffi::PANGO_GLYPH_UNKNOWN_FLAG;
65
66// rustdoc-stripper-ignore-next
67/// The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
68pub const SCALE_XX_SMALL: f64 = 0.5787037037037;
69
70// rustdoc-stripper-ignore-next
71/// The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
72pub const SCALE_X_SMALL: f64 = 0.6944444444444;
73
74// rustdoc-stripper-ignore-next
75/// The scale factor for one shrinking step (1 / 1.2).
76pub const SCALE_SMALL: f64 = 0.8333333333333;
77
78// rustdoc-stripper-ignore-next
79/// The scale factor for normal size (1.0).
80pub const SCALE_MEDIUM: f64 = 1.0;
81
82// rustdoc-stripper-ignore-next
83/// The scale factor for one magnification step (1.2).
84pub const SCALE_LARGE: f64 = 1.2;
85
86// rustdoc-stripper-ignore-next
87/// The scale factor for two magnification steps (1.2 * 1.2).
88pub const SCALE_X_LARGE: f64 = 1.44;
89
90// rustdoc-stripper-ignore-next
91/// The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
92pub const SCALE_XX_LARGE: f64 = 1.728;
93
94pub mod prelude;
95
96#[macro_use]
97mod attribute;
98pub use attribute::IsAttribute;
99
100mod analysis;
101pub use analysis::Analysis;
102mod attr_class;
103pub use attr_class::AttrClass;
104mod attr_color;
105pub use attr_color::AttrColor;
106mod attr_float;
107pub use attr_float::AttrFloat;
108mod attr_font_desc;
109pub use attr_font_desc::AttrFontDesc;
110mod attr_font_features;
111pub use attr_font_features::AttrFontFeatures;
112mod attr_int;
113pub use attr_int::AttrInt;
114mod attr_iterator;
115pub use attr_iterator::{AttrIntoIter, AttrIterator};
116mod attr_language;
117pub use attr_language::AttrLanguage;
118mod attr_list;
119mod attr_shape;
120pub use attr_shape::AttrShape;
121mod attr_size;
122pub use attr_size::AttrSize;
123mod attr_string;
124pub use attr_string::AttrString;
125mod color;
126mod coverage;
127pub use coverage::Coverage;
128mod enums;
129mod functions;
130mod glyph_geometry;
131pub use glyph_geometry::GlyphGeometry;
132mod glyph_info;
133pub use glyph_info::GlyphInfo;
134mod glyph_item;
135mod glyph_item_iter;
136pub use glyph_item_iter::{GlyphItemIntoIter, GlyphItemIter};
137mod glyph_string;
138mod item;
139mod language;
140mod layout;
141pub use layout::HitPosition;
142mod matrix;
143mod rectangle;
144pub use rectangle::Rectangle;
145mod script_iter;
146pub use script_iter::{ScriptIntoIter, ScriptIter};
147mod tab_array;