[]Struct pango::Context

pub struct Context(_, _);

The Context structure stores global information used to control the itemization process.

Implementations

impl Context[src]

pub fn new() -> Context[src]

Creates a new Context initialized to default values.

This function is not particularly useful as it should always be followed by a Context::set_font_map call, and the function FontMapExt::create_context does these two steps together and hence users are recommended to use that.

If you are using Pango as part of a higher-level system, that system may have it's own way of create a Context. For instance, the GTK+ toolkit has, among others, gdk_pango_context_get_for_screen, and gtk_widget_get_pango_context. Use those instead.

Returns

the newly allocated Context, which should be freed with gobject::Object::unref.

pub fn changed(&self)[src]

Forces a change in the context, which will cause any Layout using this context to re-layout.

This function is only useful when implementing a new backend for Pango, something applications won't do. Backends should call this function if they have attached extra data to the context and such data is changed.

pub fn get_base_dir(&self) -> Direction[src]

Retrieves the base direction for the context. See Context::set_base_dir.

Returns

the base direction for the context.

pub fn get_base_gravity(&self) -> Gravity[src]

Retrieves the base gravity for the context. See Context::set_base_gravity.

Returns

the base gravity for the context.

pub fn get_font_description(&self) -> Option<FontDescription>[src]

Retrieve the default font description for the context.

Returns

a pointer to the context's default font description. This value must not be modified or freed.

pub fn get_font_map(&self) -> Option<FontMap>[src]

Gets the FontMap used to look up fonts for this context.

Returns

the font map for the Context. This value is owned by Pango and should not be unreferenced.

pub fn get_gravity(&self) -> Gravity[src]

Retrieves the gravity for the context. This is similar to Context::get_base_gravity, except for when the base gravity is Gravity::Auto for which Gravity::get_for_matrix is used to return the gravity from the current context matrix.

Returns

the resolved gravity for the context.

pub fn get_gravity_hint(&self) -> GravityHint[src]

Retrieves the gravity hint for the context. See Context::set_gravity_hint for details.

Returns

the gravity hint for the context.

pub fn get_language(&self) -> Option<Language>[src]

Retrieves the global language tag for the context.

Returns

the global language tag.

pub fn get_matrix(&self) -> Option<Matrix>[src]

Gets the transformation matrix that will be applied when rendering with this context. See Context::set_matrix.

Returns

the matrix, or None if no matrix has been set (which is the same as the identity matrix). The returned matrix is owned by Pango and must not be modified or freed.

pub fn get_metrics(
    &self,
    desc: Option<&FontDescription>,
    language: Option<&Language>
) -> Option<FontMetrics>
[src]

Get overall metric information for a particular font description. Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

The FontDescription is interpreted in the same way as by pango_itemize, and the family name may be a comma separated list of figures. If characters from multiple of these families would be used to render the string, then the returned fonts would be a composite of the metrics for the fonts loaded for the individual families.

desc

a FontDescription structure. None means that the font description from the context will be used.

language

language tag used to determine which script to get the metrics for. None means that the language tag from the context will be used. If no language tag is set on the context, metrics for the default language (as determined by Language::get_default) will be returned.

Returns

a FontMetrics object. The caller must call FontMetrics::unref when finished using the object.

pub fn get_round_glyph_positions(&self) -> bool[src]

Returns whether font rendering with this context should round glyph positions and widths.

Feature: v1_44

pub fn get_serial(&self) -> u32[src]

Returns the current serial number of self. The serial number is initialized to an small number larger than zero when a new context is created and is increased whenever the context is changed using any of the setter functions, or the FontMap it uses to find fonts has changed. The serial may wrap, but will never have the value 0. Since it can wrap, never compare it with "less than", always use "not equals".

This can be used to automatically detect changes to a Context, and is only useful when implementing objects that need update when their Context changes, like Layout.

Returns

The current serial number of self.

pub fn list_families(&self) -> Vec<FontFamily>[src]

List all families for a context.

families

location to store a pointer to an array of FontFamily *. This array should be freed with g_free.

n_families

location to store the number of elements in descs

pub fn load_font(&self, desc: &FontDescription) -> Option<Font>[src]

Loads the font in one of the fontmaps in the context that is the closest match for desc.

desc

a FontDescription describing the font to load

Returns

the newly allocated Font that was loaded, or None if no font matched.

pub fn load_fontset(
    &self,
    desc: &FontDescription,
    language: &Language
) -> Option<Fontset>
[src]

Load a set of fonts in the context that can be used to render a font matching desc.

desc

a FontDescription describing the fonts to load

language

a Language the fonts will be used for

Returns

the newly allocated Fontset loaded, or None if no font matched.

pub fn set_base_dir(&self, direction: Direction)[src]

Sets the base direction for the context.

The base direction is used in applying the Unicode bidirectional algorithm; if the direction is Direction::Ltr or Direction::Rtl, then the value will be used as the paragraph direction in the Unicode bidirectional algorithm. A value of Direction::WeakLtr or Direction::WeakRtl is used only for paragraphs that do not contain any strong characters themselves.

direction

the new base direction

pub fn set_base_gravity(&self, gravity: Gravity)[src]

Sets the base gravity for the context.

The base gravity is used in laying vertical text out.

gravity

the new base gravity

pub fn set_font_description(&self, desc: &FontDescription)[src]

Set the default font description for the context

desc

the new pango font description

pub fn set_font_map<P: IsA<FontMap>>(&self, font_map: &P)[src]

Sets the font map to be searched when fonts are looked-up in this context. This is only for internal use by Pango backends, a Context obtained via one of the recommended methods should already have a suitable font map.

font_map

the FontMap to set.

pub fn set_gravity_hint(&self, hint: GravityHint)[src]

Sets the gravity hint for the context.

The gravity hint is used in laying vertical text out, and is only relevant if gravity of the context as returned by Context::get_gravity is set Gravity::East or Gravity::West.

hint

the new gravity hint

pub fn set_language(&self, language: &Language)[src]

Sets the global language tag for the context. The default language for the locale of the running process can be found using Language::get_default.

language

the new language tag.

pub fn set_matrix(&self, matrix: Option<&Matrix>)[src]

Sets the transformation matrix that will be applied when rendering with this context. Note that reported metrics are in the user space coordinates before the application of the matrix, not device-space coordinates after the application of the matrix. So, they don't scale with the matrix, though they may change slightly for different matrices, depending on how the text is fit to the pixel grid.

matrix

a Matrix, or None to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)

pub fn set_round_glyph_positions(&self, round_positions: bool)[src]

Sets whether font rendering with this context should round glyph positions and widths to integral positions, in device units.

This is useful when the renderer can't handle subpixel positioning of glyphs.

The default value is to round glyph positions, to remain compatible with previous Pango behavior.

Feature: v1_44

round_positions

whether to round glyph positions

Trait Implementations

impl Clone for Context

impl Debug for Context

impl Default for Context[src]

impl Display for Context[src]

impl Eq for Context

impl Hash for Context

impl Ord for Context

impl<T: ObjectType> PartialEq<T> for Context

impl<T: ObjectType> PartialOrd<T> for Context

impl StaticType for Context

Auto Trait Implementations

impl RefUnwindSafe for Context

impl !Send for Context

impl !Sync for Context

impl Unpin for Context

impl UnwindSafe for Context

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.