summaryrefslogtreecommitdiff
path: root/src/haiku_support.h
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-05 09:46:05 +0000
committerPo Lu <luangruo@yahoo.com>2022-05-05 09:46:05 +0000
commit1468eef301a59346adc47ef19a740f4e2c3737a2 (patch)
treeee16c08d185100385231849da505310cf6e9ff5e /src/haiku_support.h
parent30caeb789659441f8feb76b24f3d0b1f60125085 (diff)
downloademacs-1468eef301a59346adc47ef19a740f4e2c3737a2.tar.gz
emacs-1468eef301a59346adc47ef19a740f4e2c3737a2.tar.bz2
emacs-1468eef301a59346adc47ef19a740f4e2c3737a2.zip
Speed up opening fonts on Haiku
* src/font.h (font_property_index): Note that some font drivers use the extra data in a font entity to store driver-specific information. * src/haiku_font_support.cc (BFont_find): Set font indices. (be_open_font_at_index): New function. (BFont_open_pattern): Clean up coding style. * src/haiku_support.h (enum haiku_font_specification) (struct haiku_font_pattern): New fields and specifications for indices. * src/haikufont.c (haikufont_pattern_to_entity, haikufont_open): Use indices to open fonts if available in the extra data.
Diffstat (limited to 'src/haiku_support.h')
-rw-r--r--src/haiku_support.h48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/haiku_support.h b/src/haiku_support.h
index 63ba7260506..0fe2af3329a 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -246,6 +246,7 @@ enum haiku_font_specification
FSPEC_NEED_ONE_OF = 1 << 6,
FSPEC_WIDTH = 1 << 7,
FSPEC_LANGUAGE = 1 << 8,
+ FSPEC_INDICES = 1 << 9,
};
typedef char haiku_font_family_or_style[64];
@@ -300,25 +301,61 @@ enum haiku_font_weight
struct haiku_font_pattern
{
+ /* Bitmask indicating which fields are set. */
int specified;
+
+ /* The next font in this list. */
struct haiku_font_pattern *next;
- /* The next two fields are only temporarily used during the font
- discovery process! Do not rely on them being correct outside
- BFont_find. */
+
+ /* The last font in the list during font lookup. */
struct haiku_font_pattern *last;
+
+ /* The next font in the list whose family differs from this one.
+ Only valid during font lookup. */
struct haiku_font_pattern *next_family;
+
+ /* The family of the font. */
haiku_font_family_or_style family;
+
+ /* The style of the font. */
haiku_font_family_or_style style;
+
+ /* Whether or the font is monospace. */
int mono_spacing_p;
- int want_chars_len;
- int need_one_of_len;
+
+ /* The slant of the font. */
enum haiku_font_slant slant;
+
+ /* The width of the font. */
enum haiku_font_width width;
+
+ /* The language of the font. Used during font lookup. */
enum haiku_font_language language;
+
+ /* The weight of the font. */
enum haiku_font_weight weight;
+
+ /* List of characters that must be present in the font for the match
+ to succeed. */
int *wanted_chars;
+
+ /* The number of characters in `wanted_chars'. */
+ int want_chars_len;
+
+ /* List of characters. The font must fullfill at least one of
+ them for the match to succeed. */
int *need_one_of;
+ /* The number of characters in `need_one_of'. */
+ int need_one_of_len;
+
+ /* The index of the family of the font this pattern represents. */
+ int family_index;
+
+ /* The index of the style of the font this pattern represents. */
+ int style_index;
+
+ /* Temporary field used during font enumeration. */
int oblique_seen_p;
};
@@ -635,6 +672,7 @@ extern bool be_use_subpixel_antialiasing (void);
extern const char *be_find_setting (const char *);
extern haiku_font_family_or_style *be_list_font_families (size_t *);
extern void be_font_style_to_flags (char *, struct haiku_font_pattern *);
+extern void *be_open_font_at_index (int, int, float);
extern int be_get_ui_color (const char *, uint32_t *);
extern void BMessage_delete (void *);