From: Po Lu Date: Fri, 15 Apr 2022 12:22:26 +0000 (+0000) Subject: Fix default registry of Haiku font backend X-Git-Tag: emacs-29.0.90~1931^2~541 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dfee2790549df4be0fa841a00faafb50c9347f30;p=emacs.git Fix default registry of Haiku font backend * src/haiku_support.h (struct haiku_zoom_event): Fix coding style. (enum haiku_font_specification): Move FSPECs over here. * src/haikufont.c (haikufont_apply_registry) (haikufont_get_fallback_entity, haikufont_pattern_to_entity) (haikufont_spec_or_entity_to_pattern, haikufont_list): Use `iso10646-1' as the default registry instead of `utf8', which is not a registry. --- diff --git a/src/haiku_support.h b/src/haiku_support.h index 8462df268f8..9935906f0e3 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h @@ -221,19 +221,21 @@ struct haiku_menu_bar_help_event struct haiku_zoom_event { void *window; - bool zoomed; }; -#define FSPEC_FAMILY 1 -#define FSPEC_STYLE (1 << 1) -#define FSPEC_SLANT (1 << 2) -#define FSPEC_WEIGHT (1 << 3) -#define FSPEC_SPACING (1 << 4) -#define FSPEC_WANTED (1 << 5) -#define FSPEC_NEED_ONE_OF (1 << 6) -#define FSPEC_WIDTH (1 << 7) -#define FSPEC_LANGUAGE (1 << 8) +enum haiku_font_specification + { + FSPEC_FAMILY = 1, + FSPEC_STYLE = 1 << 1, + FSPEC_SLANT = 1 << 2, + FSPEC_WEIGHT = 1 << 3, + FSPEC_SPACING = 1 << 4, + FSPEC_WANTED = 1 << 5, + FSPEC_NEED_ONE_OF = 1 << 6, + FSPEC_WIDTH = 1 << 7, + FSPEC_LANGUAGE = 1 << 8, + }; typedef char haiku_font_family_or_style[64]; @@ -395,11 +397,8 @@ extern "C" #ifdef __cplusplus typedef void *haiku; -extern void -haiku_put_pixel (haiku, int, int, unsigned long); - -extern unsigned long -haiku_get_pixel (haiku, int, int); +extern void haiku_put_pixel (haiku, int, int, unsigned long); +extern unsigned long haiku_get_pixel (haiku, int, int); #endif extern port_id port_application_to_emacs; diff --git a/src/haikufont.c b/src/haikufont.c index b9f6dc2fe8e..f2ead5d6c25 100644 --- a/src/haikufont.c +++ b/src/haikufont.c @@ -149,6 +149,7 @@ haikufont_apply_registry (struct haiku_font_pattern *pattern, memcpy (&a[old_l], pattern->wanted_chars, (l - old_l) * sizeof *a); xfree (pattern->wanted_chars); } + pattern->specified |= FSPEC_WANTED; pattern->want_chars_len = l; pattern->wanted_chars = a; @@ -183,7 +184,7 @@ haikufont_get_fallback_entity (void) ASET (ent, FONT_FOUNDRY_INDEX, Qhaiku); ASET (ent, FONT_FAMILY_INDEX, Qnil); ASET (ent, FONT_ADSTYLE_INDEX, Qnil); - ASET (ent, FONT_REGISTRY_INDEX, Qutf_8); + ASET (ent, FONT_REGISTRY_INDEX, Qiso10646_1); ASET (ent, FONT_SIZE_INDEX, make_fixnum (0)); ASET (ent, FONT_AVGWIDTH_INDEX, make_fixnum (0)); ASET (ent, FONT_SPACING_INDEX, make_fixnum (FONT_SPACING_MONO)); @@ -387,7 +388,7 @@ haikufont_pattern_to_entity (struct haiku_font_pattern *ptn) ASET (ent, FONT_FOUNDRY_INDEX, Qhaiku); ASET (ent, FONT_FAMILY_INDEX, Qdefault); ASET (ent, FONT_ADSTYLE_INDEX, Qnil); - ASET (ent, FONT_REGISTRY_INDEX, Qutf_8); + ASET (ent, FONT_REGISTRY_INDEX, Qiso10646_1); ASET (ent, FONT_SIZE_INDEX, make_fixnum (0)); ASET (ent, FONT_AVGWIDTH_INDEX, make_fixnum (0)); ASET (ent, FONT_SPACING_INDEX, make_fixnum (FONT_SPACING_MONO)); @@ -423,8 +424,7 @@ haikufont_pattern_to_entity (struct haiku_font_pattern *ptn) } static void -haikufont_spec_or_entity_to_pattern (Lisp_Object ent, - int list_p, +haikufont_spec_or_entity_to_pattern (Lisp_Object ent, int list_p, struct haiku_font_pattern *ptn) { Lisp_Object tem; @@ -591,27 +591,29 @@ haikufont_match (struct frame *f, Lisp_Object font_spec) static Lisp_Object haikufont_list (struct frame *f, Lisp_Object font_spec) { - block_input (); - Lisp_Object lst = Qnil; + Lisp_Object lst, tem; + struct haiku_font_pattern ptn, *found, *pt; + lst = Qnil; + + block_input (); /* Returning irrelevant results on receiving an OTF form will cause fontset.c to loop over and over, making displaying some characters very slow. */ - Lisp_Object tem = assq_no_quit (QCotf, AREF (font_spec, FONT_EXTRA_INDEX)); + tem = assq_no_quit (QCotf, AREF (font_spec, FONT_EXTRA_INDEX)); + if (CONSP (tem) && !NILP (XCDR (tem))) { unblock_input (); return Qnil; } - struct haiku_font_pattern ptn; haikufont_spec_or_entity_to_pattern (font_spec, 1, &ptn); - struct haiku_font_pattern *found = BFont_find (&ptn); + found = BFont_find (&ptn); haikufont_done_with_query_pattern (&ptn); if (found) { - for (struct haiku_font_pattern *pt = found; - pt; pt = pt->next) + for (pt = found; pt; pt = pt->next) lst = Fcons (haikufont_pattern_to_entity (pt), lst); haiku_font_pattern_free (found); }