Graphviz 13.0.0~dev.20241220.2304
|
#include <assert.h>
#include <common/render.h>
#include <common/textspan_lut.h>
#include <common/types.h>
#include <common/utils.h>
#include <ctype.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <util/agxbuf.h>
#include <util/gv_ctype.h>
Go to the source code of this file.
Data Structures | |
struct | FontFamilyMetrics |
Functions | |
static bool | font_name_equal_permissive (const char *a, const char *b) |
static bool | font_in_list_permissive (const char *value, const char **list) |
static const struct FontFamilyMetrics * | get_metrics_for_font_family (const char *font_name) |
static const short * | get_metrics_for_font_variant (const struct FontFamilyMetrics *family_metrics, bool bold, bool italic) |
static unsigned short | estimate_character_width_canonical (const short variant_metrics[128], unsigned character) |
double | estimate_text_width_1pt (const char *font_name, const char *text, bool bold, bool italic) |
Variables | |
static const struct FontFamilyMetrics | all_font_metrics [] |
static const size_t | all_font_metrics_len |
|
static |
Definition at line 801 of file textspan_lut.c.
References agwarningf().
Referenced by estimate_text_width_1pt().
double estimate_text_width_1pt | ( | const char * | font_name, |
const char * | text, | ||
bool | bold, | ||
bool | italic | ||
) |
text | a single line of ASCII text which should contain no control characters. |
text
in 1 point. A value is always returned, falling back to Times-Roman metrics if there is no hard-coded lookup table for the given font_name
. Definition at line 830 of file textspan_lut.c.
References estimate_character_width_canonical(), FontFamilyMetrics::font_name, get_metrics_for_font_family(), get_metrics_for_font_variant(), and FontFamilyMetrics::units_per_em.
Referenced by estimate_textspan_size().
|
static |
Checks whether a font name is in a list of font names, ignoring case and special characters.
E.g. "Times-Roman" and "TimesNewRoman" are both in {"times", "timesroman", "timesnewroman", NULL}, but "Arial" is not.
Definition at line 751 of file textspan_lut.c.
References font_name_equal_permissive(), and NULL.
Referenced by get_metrics_for_font_family().
|
static |
Compares two font names for equality, ignoring case and all characters except ASCII letters
E.g. "timesroman", "Times-Roman", "times ROMAN", "times_roman" and "tim8esroman" are all considered equal to each other, but not equal to "Times New Roman".
Definition at line 711 of file textspan_lut.c.
References gv_isalpha().
Referenced by font_in_list_permissive().
|
static |
Definition at line 765 of file textspan_lut.c.
References agwarningf(), agxbfree(), agxbprint(), agxbuse(), all_font_metrics, all_font_metrics_len, emit_once(), font_in_list_permissive(), FontFamilyMetrics::font_name, and get_metrics_for_font_family().
Referenced by estimate_text_width_1pt(), and get_metrics_for_font_family().
|
static |
Definition at line 785 of file textspan_lut.c.
References FontFamilyMetrics::widths_bold, FontFamilyMetrics::widths_bold_italic, FontFamilyMetrics::widths_italic, and FontFamilyMetrics::widths_regular.
Referenced by estimate_text_width_1pt().
|
static |
Definition at line 34 of file textspan_lut.c.
Referenced by get_metrics_for_font_family().
|
static |
Definition at line 702 of file textspan_lut.c.
Referenced by get_metrics_for_font_family().