📄 pango-layout.c
字号:
* pango_layout_is_wrapped: * @layout: a #PangoLayout * * Queries whether the layout had to wrap any paragraphs. * * This returns %TRUE if a positive width is set on @layout, * ellipsization mode of @layout is set to %PANGO_ELLIPSIZE_NONE, * and there are paragraphs exceeding the layout width that have * to be wrapped. * * Return value: %TRUE if any paragraphs had to be wrapped, %FALSE * otherwise. * * Since: 1.16 */gbooleanpango_layout_is_wrapped (PangoLayout *layout){ g_return_val_if_fail (layout != NULL, FALSE); pango_layout_check_lines (layout); return layout->is_wrapped;}/** * pango_layout_set_indent * @layout: a #PangoLayout. * @indent: the amount by which to indent. * * Sets the width in Pango units to indent each paragraph. A negative value * of @indent will produce a hanging indentation. That is, the first line will * have the full width, and subsequent lines will be indented by the * absolute value of @indent. * * The indent setting is ignored if layout alignment is set to * %PANGO_ALIGN_CENTER. **/voidpango_layout_set_indent (PangoLayout *layout, int indent){ g_return_if_fail (layout != NULL); if (indent != layout->indent) { layout->indent = indent; pango_layout_clear_lines (layout); }}/** * pango_layout_get_indent: * @layout: a #PangoLayout * * Gets the paragraph indent width in Pango units. A negative value * indicates a hanging indentation. * * Return value: the indent in Pango units. **/intpango_layout_get_indent (PangoLayout *layout){ g_return_val_if_fail (layout != NULL, 0); return layout->indent;}/** * pango_layout_set_spacing: * @layout: a #PangoLayout. * @spacing: the amount of spacing * * Sets the amount of spacing in Pango unit between the lines of the * layout. **/voidpango_layout_set_spacing (PangoLayout *layout, int spacing){ g_return_if_fail (layout != NULL); if (spacing != layout->spacing) { layout->spacing = spacing; pango_layout_clear_lines (layout); }}/** * pango_layout_get_spacing: * @layout: a #PangoLayout * * Gets the amount of spacing between the lines of the layout. * * Return value: the spacing in Pango units. **/intpango_layout_get_spacing (PangoLayout *layout){ g_return_val_if_fail (layout != NULL, 0); return layout->spacing;}/** * pango_layout_set_attributes: * @layout: a #PangoLayout * @attrs: a #PangoAttrList, can be %NULL * * Sets the text attributes for a layout object. * References @attrs, so the caller can unref its reference. **/voidpango_layout_set_attributes (PangoLayout *layout, PangoAttrList *attrs){ PangoAttrList *old_attrs; g_return_if_fail (layout != NULL); old_attrs = layout->attrs; layout->attrs = attrs; if (layout->attrs) pango_attr_list_ref (layout->attrs); pango_layout_clear_lines (layout); if (old_attrs) pango_attr_list_unref (old_attrs); layout->tab_width = -1;}/** * pango_layout_get_attributes: * @layout: a #PangoLayout * * Gets the attribute list for the layout, if any. * * Return value: a #PangoAttrList. **/PangoAttrList*pango_layout_get_attributes (PangoLayout *layout){ g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); return layout->attrs;}/** * pango_layout_set_font_description: * @layout: a #PangoLayout * @desc: the new #PangoFontDescription, or %NULL to unset the * current font description * * Sets the default font description for the layout. If no font * description is set on the layout, the font description from * the layout's context is used. **/voidpango_layout_set_font_description (PangoLayout *layout, const PangoFontDescription *desc){ g_return_if_fail (layout != NULL); if (desc != layout->font_desc) { if (layout->font_desc) pango_font_description_free (layout->font_desc); if (desc) layout->font_desc = pango_font_description_copy (desc); else layout->font_desc = NULL; pango_layout_clear_lines (layout); layout->tab_width = -1; }}/** * pango_layout_get_font_description: * @layout: a #PangoLayout * * Gets the font description for the layout, if any. * * Return value: a pointer to the layout's font description, * or %NULL if the font description from the layout's * context is inherited. This value is owned by the layout * and must not be modified or freed. * * Since: 1.8 **/G_CONST_RETURN PangoFontDescription *pango_layout_get_font_description (PangoLayout *layout){ g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); return layout->font_desc;}/** * pango_layout_set_justify: * @layout: a #PangoLayout * @justify: whether the lines in the layout should be justified. * * Sets whether each complete line should be stretched to * fill the entire width of the layout. This stretching is typically * done by adding whitespace, but for some scripts (such as Arabic), * the justification may be done in more complex ways, like extending * the characters. * * Note that this setting is not implemented and so is ignored in Pango * older than 1.18. **/voidpango_layout_set_justify (PangoLayout *layout, gboolean justify){ g_return_if_fail (layout != NULL); layout->justify = justify;}/** * pango_layout_get_justify: * @layout: a #PangoLayout * * Gets whether each complete line should be stretched to fill the entire * width of the layout. * * Return value: the justify. **/gbooleanpango_layout_get_justify (PangoLayout *layout){ g_return_val_if_fail (layout != NULL, FALSE); return layout->justify;}/** * pango_layout_set_auto_dir: * @layout: a #PangoLayout * @auto_dir: if %TRUE, compute the bidirectional base direction * from the layout's contents. * * Sets whether to calculate the bidirectional base direction * for the layout according to the contents of the layout; * when this flag is on (the default), then paragraphs in @layout that begin with strong right-to-left characters * (Arabic and Hebrew principally), will have right-to-left * layout, paragraphs with letters from other scripts will * have left-to-right layout. Paragraphs with only neutral * characters get their direction from the surrounding paragraphs. * * When %FALSE, the choice between left-to-right and * right-to-left layout is done according to the base direction * of the layout's #PangoContext. (See pango_context_set_base_dir()). * * When the auto-computed direction of a paragraph differs from the * base direction of the context, the interpretation of * %PANGO_ALIGN_LEFT and %PANGO_ALIGN_RIGHT are swapped. * * Since: 1.4 **/voidpango_layout_set_auto_dir (PangoLayout *layout, gboolean auto_dir){ g_return_if_fail (PANGO_IS_LAYOUT (layout)); auto_dir = auto_dir != FALSE; if (auto_dir != layout->auto_dir) { layout->auto_dir = auto_dir; pango_layout_clear_lines (layout); }}/** * pango_layout_get_auto_dir: * @layout: a #PangoLayout * * Gets whether to calculate the bidirectional base direction * for the layout according to the contents of the layout. * See pango_layout_set_auto_dir(). * * Return value: %TRUE if the bidirectional base direction * is computed from the layout's contents, %FALSE otherwise. * * Since: 1.4 **/gbooleanpango_layout_get_auto_dir (PangoLayout *layout){ g_return_val_if_fail (PANGO_IS_LAYOUT (layout), FALSE); return layout->auto_dir;}/** * pango_layout_set_alignment: * @layout: a #PangoLayout * @alignment: the alignment * * Sets the alignment for the layout: how partial lines are * positioned within the horizontal space available. **/voidpango_layout_set_alignment (PangoLayout *layout, PangoAlignment alignment){ g_return_if_fail (layout != NULL); layout->alignment = alignment;}/** * pango_layout_get_alignment: * @layout: a #PangoLayout * * Gets the alignment for the layout: how partial lines are * positioned within the horizontal space available. * * Return value: the alignment. **/PangoAlignmentpango_layout_get_alignment (PangoLayout *layout){ g_return_val_if_fail (layout != NULL, PANGO_ALIGN_LEFT); return layout->alignment;}/** * pango_layout_set_tabs: * @layout: a #PangoLayout * @tabs: a #PangoTabArray * * Sets the tabs to use for @layout, overriding the default tabs * (by default, tabs are every 8 spaces). If @tabs is %NULL, the default * tabs are reinstated. @tabs is copied into the layout; you must * free your copy of @tabs yourself. **/voidpango_layout_set_tabs (PangoLayout *layout, PangoTabArray *tabs){ g_return_if_fail (PANGO_IS_LAYOUT (layout)); if (layout->tabs) pango_tab_array_free (layout->tabs); layout->tabs = tabs ? pango_tab_array_copy (tabs) : NULL;}/** * pango_layout_get_tabs: * @layout: a #PangoLayout * * Gets the current #PangoTabArray used by this layout. If no * #PangoTabArray has been set, then the default tabs are in use * and %NULL is returned. Default tabs are every 8 spaces. * The return value should be freed with pango_tab_array_free(). * * Return value: a copy of the tabs for this layout, or %NULL. **/PangoTabArray*pango_layout_get_tabs (PangoLayout *layout){ g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); if (layout->tabs) return pango_tab_array_copy (layout->tabs); else return NULL;}/** * pango_layout_set_single_paragraph_mode: * @layout: a #PangoLayout * @setting: new setting * * If @setting is %TRUE, do not treat newlines and similar characters * as paragraph separators; instead, keep all text in a single paragraph, * and display a glyph for paragraph separator characters. Used when * you want to allow editing of newlines on a single text line. **/voidpango_layout_set_single_paragraph_mode (PangoLayout *layout, gboolean setting){ g_return_if_fail (PANGO_IS_LAYOUT (layout)); setting = setting != FALSE; if (layout->single_paragraph != setting) { layout->single_paragraph = setting; pango_layout_clear_lines (layout); }}/** * pango_layout_get_single_paragraph_mode: * @layout: a #PangoLayout * * Obtains the value set by pango_layout_set_single_paragraph_mode(). * * Return value: %TRUE if the layout does not break paragraphs at * paragraph separator characters, %FALSE otherwise. **/gbooleanpango_layout_get_single_paragraph_mode (PangoLayout *layout){ g_return_val_if_fail (PANGO_IS_LAYOUT (layout), FALSE); return layout->single_paragraph;}/** * pango_layout_set_ellipsize: * @layout: a #PangoLayout * @ellipsize: the new ellipsization mode for @layout * * Sets the type of ellipsization being performed for @layout. * Depending on the ellipsization mode @ellipsize text is * removed from the start, middle, or end of text so they * fit within the width and height of layout set with * pango_layout_set_width() and pango_layout_set_height(). * * If the layout contains characters such as newlines that * force it to be layed out in multiple paragraphs, then whether * each paragraph is ellipsized separately or the entire layout * is ellipsized as a whole depends on the set height of the layout. * See pango_layout_set_height() for details. * * Since: 1.6 **/voidpango_layout_set_ellipsize (PangoLayout *layout, PangoEllipsizeMode ellipsize){ g_return_if_fail (PANGO_IS_LAYOUT (layout)); if (ellipsize != layout->ellipsize) { layout->ellipsize = ellipsize; if (layout->is_ellipsized || layout->is_wrapped) pango_layout_clear_lines (layout); }}/** * pango_layout_get_ellipsize: * @layout: a #PangoLayout * * Gets the type of ellipsization being performed for @layout. * See pango_layout_set_ellipsize() * * Return value: the current ellipsization mode for @layout. * * Use pango_layout_is_ellipsized() to query whether any paragraphs * were actually ellipsized. * * Since: 1.6 **/PangoEllipsizeModepango_layout_get_ellipsize (PangoLayout *layout){ g_return_val_if_fail (PANGO_IS_LAYOUT (layout), PANGO_ELLIPSIZE_NONE); return layout->ellipsize;}/** * pango_layout_is_ellipsized: * @layout: a #PangoLayout * * Queries whether the layout had to ellipsize any paragraphs. * * This returns %TRUE if the ellipsization mode for @layout * is not %PANGO_ELLIPSIZE_NONE, a positive width is set on @layout, * and there are paragraphs exceeding that width that have to be * ellipsized. * * Return value: %TRUE if any paragraphs had to be ellipsized, %FALSE * otherwise. * * Since: 1.16 */gbooleanpango_layout_is_ellipsized (PangoLayout *layout)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -