/* Font backend for the Microsoft W32 API.
- Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2007-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#define JOHAB_CHARSET 130
#endif
-extern struct font_driver w32font_driver;
-
Lisp_Object Qgdi;
Lisp_Object Quniscribe;
static Lisp_Object QCformat;
static Lisp_Object Qraster, Qoutline, Qunknown;
/* antialiasing */
-extern Lisp_Object QCantialias, QCotf, QClang; /* defined in font.c */
extern Lisp_Object Qnone; /* reuse from w32fns.c */
static Lisp_Object Qstandard, Qsubpixel, Qnatural;
static Lisp_Object Qzh;
/* scripts */
-static Lisp_Object Qlatin, Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew;
+static Lisp_Object Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew;
static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali;
static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu;
static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao;
static Lisp_Object Qw32_charset_hebrew, Qw32_charset_vietnamese;
static Lisp_Object Qw32_charset_thai, Qw32_charset_johab, Qw32_charset_mac;
-/* Associative list linking character set strings to Windows codepages. */
-static Lisp_Object Vw32_charset_info_alist;
-
/* Font spacing symbols - defined in font.c. */
extern Lisp_Object Qc, Qp, Qm;
/* The following code is copied from the function intern (in lread.c). */
obarray = Vobarray;
- if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+ if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
obarray = check_obarray (obarray);
tem = oblookup (obarray, SDATA (str), len, len);
if (SYMBOLP (tem))
}
/* w32 implementation of encode_char for font backend.
- Return a glyph code of FONT for characer C (Unicode code point).
+ Return a glyph code of FONT for character C (Unicode code point).
If FONT doesn't have such a glyph, return FONT_INVALID_CODE.
For speed, the gdi backend uses unicode (Emacs calls encode_char
{
UINT options;
HRGN orig_clip = NULL;
+ int len = to - from;
struct w32font_info *w32font = (struct w32font_info *) s->font;
options = w32font->glyph_idx;
if (s->padding_p)
{
- int len = to - from, i;
+ int i;
for (i = 0; i < len; i++)
ExtTextOutW (s->hdc, x + i, y, options, NULL,
s->char2b + from + i, 1, NULL);
}
else
- ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL);
+ ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL);
/* Restore clip region. */
if (s->num_clips > 0)
if (orig_clip)
DeleteObject (orig_clip);
+
+ return len;
}
/* w32 implementation of free_entity for font backend.
w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
int pixel_size, Lisp_Object font_object)
{
- int len, size, i;
+ int len, size;
LOGFONT logfont;
HDC dc;
HFONT hfont, old_font;
/* Convert generic families to the family portion of lfPitchAndFamily. */
-BYTE
+static BYTE
w32_generic_family (Lisp_Object name)
{
/* Generic families. */
if (fnweight >= FW_NORMAL) return 100;
if (fnweight >= FW_LIGHT) return 50;
if (fnweight >= FW_EXTRALIGHT) return 40;
- if (fnweight > FW_THIN) return 20;
+ if (fnweight > FW_THIN) return 20;
return 0;
}
if (n >= 100) return FW_NORMAL;
if (n >= 50) return FW_LIGHT;
if (n >= 40) return FW_EXTRALIGHT;
- if (n >= 20) return FW_THIN;
+ if (n >= 20) return FW_THIN;
return 0;
}
w32_to_fc_weight (int n)
{
if (n >= FW_EXTRABOLD) return intern ("black");
- if (n >= FW_BOLD) return intern ("bold");
- if (n >= FW_SEMIBOLD) return intern ("demibold");
- if (n >= FW_NORMAL) return intern ("medium");
+ if (n >= FW_BOLD) return intern ("bold");
+ if (n >= FW_SEMIBOLD) return intern ("demibold");
+ if (n >= FW_NORMAL) return intern ("medium");
return intern ("light");
}
logfont->lfPitchAndFamily = family | DEFAULT_PITCH;
}
-
/* Set pitch based on the spacing property. */
tmp = AREF (font_spec, FONT_SPACING_INDEX);
if (INTEGERP (tmp))
return DECODE_SYSTEM (build_string (buf));
}
+static const char *const w32font_booleans [] = {
+ NULL,
+};
+
+static const char *const w32font_non_booleans [] = {
+ ":script",
+ ":antialias",
+ ":style",
+ NULL,
+};
+
+static void
+w32font_filter_properties (Lisp_Object font, Lisp_Object alist)
+{
+ font_filter_properties (font, alist, w32font_booleans, w32font_non_booleans);
+}
+
struct font_driver w32font_driver =
{
0, /* Qgdi */
NULL, /* shape */
NULL, /* check */
NULL, /* get_variation_glyphs */
- NULL, /* filter_properties */
+ w32font_filter_properties,
+ NULL, /* cached_font_ok */
};
/* W32 font encodings. */
DEFVAR_LISP ("w32-charset-info-alist",
- &Vw32_charset_info_alist,
+ Vw32_charset_info_alist,
doc: /* Alist linking Emacs character sets to Windows fonts and codepages.
Each entry should be of the form:
w32font_driver.type = Qgdi;
register_font_driver (&w32font_driver, NULL);
}
-
-/* arch-tag: 65b8a3cd-46aa-4c0d-a1f3-99e75b9c07ee
- (do not change this comment) */