📄 fonts.c
字号:
metrics->strikethrough_thickness = PANGO_SCALE; return metrics; } return PANGO_FONT_GET_CLASS (font)->get_metrics (font, language);}/** * pango_font_get_font_map: * @font: a #PangoFont * * Gets the font map for which the font was created. * * Return value: the #PangoFontMap for the font * * Since: 1.10 **/PangoFontMap *pango_font_get_font_map (PangoFont *font){ if (G_UNLIKELY (!font)) { if (!_pango_warning_history.get_font_map) { _pango_warning_history.get_font_map = TRUE; g_warning (bad_font_warning, "pango_font_get_font_map"); } return NULL; } if (PANGO_FONT_GET_CLASS (font)->get_font_map) return PANGO_FONT_GET_CLASS (font)->get_font_map (font); else return NULL;}GTypepango_font_metrics_get_type (void){ static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static (I_("PangoFontMetrics"), (GBoxedCopyFunc)pango_font_metrics_ref, (GBoxedFreeFunc)pango_font_metrics_unref); return our_type;}/** * pango_font_metrics_new: * * Creates a new #PangoFontMetrics structure. This is only for * internal use by Pango backends and there is no public way * to set the fields of the structure. * * Return value: a newly-created #PangoFontMetrics structure * with a reference count of 1. **/PangoFontMetrics *pango_font_metrics_new (void){ PangoFontMetrics *metrics = g_slice_new0 (PangoFontMetrics); metrics->ref_count = 1; return metrics;}/** * pango_font_metrics_ref: * @metrics: a #PangoFontMetrics structure * * Increase the reference count of a font metrics structure by one. * * Return value: @metrics **/PangoFontMetrics *pango_font_metrics_ref (PangoFontMetrics *metrics){ if (!metrics) return NULL; metrics->ref_count++; return metrics;}/** * pango_font_metrics_unref: * @metrics: a #PangoFontMetrics structure * * Decrease the reference count of a font metrics structure by one. If * the result is zero, frees the structure and any associated * memory. **/voidpango_font_metrics_unref (PangoFontMetrics *metrics){ if (!metrics) return; g_return_if_fail (metrics->ref_count > 0 ); metrics->ref_count--; if (metrics->ref_count == 0) g_slice_free (PangoFontMetrics, metrics);}/** * pango_font_metrics_get_ascent: * @metrics: a #PangoFontMetrics structure * * 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.) * * Return value: the ascent, in Pango units. (1 point == %PANGO_SCALE Pango units.) **/intpango_font_metrics_get_ascent (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->ascent;}/** * pango_font_metrics_get_descent: * @metrics: a #PangoFontMetrics structure * * 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.) * * Return value: the descent, in Pango units. (1 point == %PANGO_SCALE Pango units.) **/intpango_font_metrics_get_descent (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->descent;}/** * pango_font_metrics_get_approximate_char_width: * @metrics: a #PangoFontMetrics structure * * 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. * * Return value: the character width, in Pango units. (1 point == %PANGO_SCALE Pango units.) **/intpango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->approximate_char_width;}/** * pango_font_metrics_get_approximate_digit_width: * @metrics: a #PangoFontMetrics structure * * 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. * * Return value: the digit width, in Pango units. (1 point == %PANGO_SCALE Pango units.) **/intpango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->approximate_digit_width;}/** * pango_font_metrics_get_underline_position: * @metrics: a #PangoFontMetrics structure * * Gets the suggested position to draw the underline. * The value returned is the distance <emphasis>above</emphasis> the * baseline of the top of the underline. Since most fonts have * underline positions beneath the baseline, this value is typically * negative. * * Return value: the suggested underline position, in Pango units. * * Since: 1.6 **/intpango_font_metrics_get_underline_position (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->underline_position;}/** * pango_font_metrics_get_underline_thickness: * @metrics: a #PangoFontMetrics structure * * Gets the suggested thickness to draw for the underline. * * Return value: the suggested underline thickness, in Pango units. * * Since: 1.6 **/intpango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->underline_thickness;}/** * pango_font_metrics_get_strikethrough_position: * @metrics: a #PangoFontMetrics structure * * Gets the suggested position to draw the strikethrough. * The value returned is the distance <emphasis>above</emphasis> the * baseline of the top of the strikethrough. * * Return value: the suggested strikethrough position, in Pango units. * * Since: 1.6 **/intpango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->strikethrough_position;}/** * pango_font_metrics_get_strikethrough_thickness: * @metrics: a #PangoFontMetrics structure * * Gets the suggested thickness to draw for the strikethrough. * * Return value: the suggested strikethrough thickness, in Pango units. * * Since: 1.6 **/intpango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics){ g_return_val_if_fail (metrics != NULL, 0); return metrics->strikethrough_thickness;}/* * PangoFontFamily */G_DEFINE_TYPE (PangoFontFamily, pango_font_family, G_TYPE_OBJECT)static voidpango_font_family_class_init (PangoFontFamilyClass *class){}static voidpango_font_family_init (PangoFontFamily *family){}/** * pango_font_family_get_name: * @family: a #PangoFontFamily * * Gets the name of the family. The name is unique among all * fonts for the font backend and can be used in a #PangoFontDescription * to specify that a face from this family is desired. * * Return value: the name of the family. This string is owned * by the family object and must not be modified or freed. **/G_CONST_RETURN char *pango_font_family_get_name (PangoFontFamily *family){ g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), NULL); return PANGO_FONT_FAMILY_GET_CLASS (family)->get_name (family);}/** * pango_font_family_list_faces: * @family: a #PangoFontFamily * @faces: location to store an array of pointers to #PangoFontFace * objects, or %NULL. This array should be freed with g_free() * when it is no longer needed. * @n_faces: location to store number of elements in @faces. * * Lists the different font faces that make up @family. The faces * in a family share a common design, but differ in slant, weight, * width and other aspects. **/voidpango_font_family_list_faces (PangoFontFamily *family, PangoFontFace ***faces, int *n_faces){ g_return_if_fail (PANGO_IS_FONT_FAMILY (family)); PANGO_FONT_FAMILY_GET_CLASS (family)->list_faces (family, faces, n_faces);}/** * pango_font_family_is_monospace: * @family: a #PangoFontFamily * * A monospace font is a font designed for text display where the the * characters form a regular grid. For Western languages this would * mean that the advance width of all characters are the same, but * this categorization also includes Asian fonts which include * double-width characters: characters that occupy two grid cells. * g_unichar_iswide() returns a result that indicates whether a * character is typically double-width in a monospace font. * * The best way to find out the grid-cell size is to call * pango_font_metrics_get_approximate_digit_width(), since the results * of pango_font_metrics_get_approximate_char_width() may be affected * by double-width characters. * * Return value: %TRUE if the family is monospace. * * Since: 1.4 **/gbooleanpango_font_family_is_monospace (PangoFontFamily *family){ g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), FALSE); if (PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace) return PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace (family); else return FALSE;}/* * PangoFontFace */G_DEFINE_TYPE (PangoFontFace, pango_font_face, G_TYPE_OBJECT)static voidpango_font_face_class_init (PangoFontFaceClass *class){}static voidpango_font_face_init (PangoFontFace *face){}/** * pango_font_face_describe: * @face: a #PangoFontFace * * Returns the family, style, variant, weight and stretch of * a #PangoFontFace. The size field of the resulting font description * will be unset. * * Return value: a newly-created #PangoFontDescription structure * holding the description of the face. Use pango_font_description_free() * to free the result. **/PangoFontDescription *pango_font_face_describe (PangoFontFace *face){ g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL); return PANGO_FONT_FACE_GET_CLASS (face)->describe (face);}/** * pango_font_face_get_face_name: * @face: a #PangoFontFace. * * Gets a name representing the style of this face among the * different faces in the #PangoFontFamily for the face. This * name is unique among all faces in the family and is suitable * for displaying to users. * * Return value: the face name for the face. This string is * owned by the face object and must not be modified or freed. **/G_CONST_RETURN char *pango_font_face_get_face_name (PangoFontFace *face){ g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL); return PANGO_FONT_FACE_GET_CLASS (face)->get_face_name (face);}/** * pango_font_face_list_sizes: * @face: a #PangoFontFace. * @sizes: location to store a pointer to an array of int. This array * should be freed with g_free(). * @n_sizes: location to store the number of elements in @sizes * * List the available sizes for a font. This is only applicable to bitmap * fonts. For scalable fonts, stores %NULL at the location pointed to by * @sizes and 0 at the location pointed to by @n_sizes. The sizes returned * are in Pango units and are sorted in ascending order. * * Since: 1.4 **/voidpango_font_face_list_sizes (PangoFontFace *face, int **sizes, int *n_sizes){ g_return_if_fail (PANGO_IS_FONT_FACE (face)); g_return_if_fail (sizes == NULL || n_sizes != NULL); if (n_sizes == NULL) return; if (PANGO_FONT_FACE_GET_CLASS (face)->list_sizes != NULL) PANGO_FONT_FACE_GET_CLASS (face)->list_sizes (face, sizes, n_sizes); else { if (sizes != NULL) *sizes = NULL; *n_sizes = 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -