[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what is the status of the XFT branch?
From: |
Kenichi Handa |
Subject: |
Re: what is the status of the XFT branch? |
Date: |
Mon, 17 Apr 2006 21:53:31 +0900 |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) |
In article <address@hidden>, Jan Djärv <address@hidden> writes:
> Pedro Kröger wrote:
>> Hi,
>>
>> I just compiled the xft branch of emacs and it's amazing! But I've read
>> it's not maintained any more. Some emails mentioned a merge of the xft
>> branch with the unicode one. So I'd like to ask: what is the status of
>> the xft support in emacs? is there any branch with it been maintained?
>>
> It is not maintained, because we need to move to unicode, so the unicode-xft
> branch will be maintained. However, don't expect much to happen before the
> upcoming Emacs release.
Actually, after reading codes of XFT branch, I started to
design a new font handling mechanism. The basic plan is to
use multiple font-backends drivers (xcore, xft, windows,
bdf, atm, etc). The main motivation for this rewriting is
that the current XFT code in the branch is very difficult to
utilize fontconfig's help for font selection, and to drive
OTF fonts. And also, I want to clean up the current fairly
complicated font related codes (including many HAVE_XFT
conditionals, many XLFD parsing code, etc).
But, as there are many other works to be done, the progress
for the above code is slow. Please don't expect a quick
response on this matter. Anyway, here's the current font.h
file (not yet fully considered) with which you may get a
feeling of the design.
---
Kenichi Handa
address@hidden
/* font.h -- Interface definition for font handling.
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef FONT_H_INCLUDED
#define FONT_H_INCLUDED
#include "ccl.h"
/* We have three concepts concerning font.
FONT-SPEC
Vector (length FONT_MAX_INDEX) of font properties. Some
properties can be left unspecified (i.e. nil). Emacs asks
font-drivers to find a font by FONT-SPEC. A fontset entry
specifies requisite properties whereas a face specifies just
preferable properties.
FONT-ENTITY
Vector (length FONT_MAX_INDEX) of fully specified font
properties that a font-driver returns upon a request of
FONT-SPEC.
FONT-OBJECT
"struct font_info" corresponding to an opened font.
*/
struct font_driver;
struct font_info;
enum font_property_index
{
/* index value in spec value in entity */
/* FONT-TYPE is a symbol indicating font-driver; one of `x',
`freetype', `bdf', `windows', `atm'. See "enum font_type" for
more info. */
FONT_TYPE_INDEX, /* symbol integer */
/* FONT-FAMILY is a family name or a combination of a foundry and
family name. */
FONT_FAMILY_INDEX, /* symbol symbol */
/* FONT-STYLE is a combination of weight, slant, and swidth. It
is possible to encode it in an integer:
(WEIGHT << 16) | (SLANT << 8) | SWIDTH
where WEIGHT, SLANT, SWIDTH are numbers less than 256 defined as
FC_WEIGHT_*, FC_SLANT_*, FC_WIDTH_* macros in fontconfig.h. */
FONT_STYLE_INDEX, /* symbol or integer integer */
/* FONT-ADSTYLE is a additional style name. */
FONT_ADSTYLE_INDEX, /* symbol symbol */
/* FONT-SIZE is a size of the font. If positive, it is a point
size in the unit of 1/10 point. If negative, its absolute
value is a pixel size. If zero, the font is scalable. */
FONT_SIZE_INDEX, /* integer or nil integer */
/* FONT-REGISTRY is a combination of a registry and encoding
name. */
FONT_REGISTRY_INDEX, /* symbol symbol */
/* FONT-EXTRA is an alist of extra information (e.g. OpenType
features, language coverage) about the font. */
FONT_EXTRA_INDEX, /* alist alist */
/* This value is the length of font-spec/entity vector. */
FONT_MAX_INDEX
};
enum font_sort_key
{
FONT_SKEY_WEIGHT,
FONT_SKEY_SLANT,
FONT_SKEY_SWIDTH,
FONT_SKEY_SIZE,
FONT_SKEY_MAX
};
enum font_type
{
FONT_TYPE_X,
FONT_TYPE_FREETYPE,
FONT_TYPE_BDF,
FONT_TYPE_WINDOWS,
FONT_TYPE_ATM,
FONT_TYPE_MAX,
FONT_TYPE_UNSPECIFIED
};
extern Lisp_Object Qx, Qfreetype, Qbdf, Qwindows, Qatm;
extern Lisp_Object Qotf, Qlanguage;
enum font_name_type
{
FONT_NAME_XLFD,
FONT_NAME_FC,
FONT_NAME_MAX
};
/* This data type is used for the font_table field of window system
depending data area (e.g. struct x_display_info on X window). */
struct font_info
{
/* Pointer to font-driver dependent font structure. */
void *font;
/* Index number of the font. */
int font_idx;
/* Index number of the entity of the font. */
int entity_idx;
/* Name to be used to find the font. */
char *name;
/* Full name of the font given by a font driver. */
char *full_name;
/* Charset to encode a character code into a glyph code of the font.
-1 means to drive the font directly by glyph code. */
int charset;
#ifdef WINDOWSNT
/* Codepage of characters that will be displayed by the font. */
int codepage;
#endif
/* Maximum bound width over all existing characters of the font.
For X core fonts, this is same as (font->max_bounds.width) */
int size;
/* Height of the font. For X core fonts, this is the same as
(font->ascent + font->descent). */
int height;
/* Width of the space glyph of the font. */
int space_width;
/* Average width of glyphs in the font. */
int average_width;
/* 1 iff `vertical-centering-font-regexp' matches the font name.
In this case, we render characters at vartical center positions
of lines. */
int vertical_centering;
/* Encoding type of the font. The value is one of
0, 1, 2, or 3:
0: code points 0x20..0x7F or 0x2020..0x7F7F are used
1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used
2: code points 0x20A0..0x7FFF are used
3: code points 0xA020..0xFF7F are used
If the member `font_encoder' is not NULL, this member is ignored.
*/
unsigned char encoding_type;
/* The baseline position of a font is normally `ascent' value of the
font. However, there exists many fonts which don't set `ascent'
an appropriate value to be used as baseline position. This is
typical in such ASCII fonts which are designed to be used with
Chinese, Japanese, Korean characters. When we use mixture of
such fonts and normal fonts (having correct `ascent' value), a
display line gets very ugly. Since we have no way to fix it
automatically, it is users responsibility to supply well designed
fonts or correct `ascent' value of fonts. But, the latter
requires heavy work (modifying all bitmap data in BDF files).
So, Emacs accepts a private font property
`_MULE_BASELINE_OFFSET'. If a font has this property, we
calculate the baseline position by subtracting the value from
`ascent'. In other words, the value indicates how many bits
higher we should draw a character of the font than normal ASCII
text for a better looking.
We also have to consider the fact that the concept of `baseline'
differs among languages to which each character belongs. For
instance, baseline should be at the bottom most position of all
glyphs for Chinese, Japanese, and Korean. But, many of existing
fonts for those characters doesn't have correct `ascent' values
because they are designed to be used with ASCII fonts. To
display characters of different language on the same line, the
best way will be to arrange them in the middle of the line. So,
in such a case, again, we utilize the font property
`_MULE_BASELINE_OFFSET'. If the value is larger than `ascent' we
calculate baseline so that a character is arranged in the middle
of a line. */
int baseline_offset;
/* Non zero means a character should be composed at a position
relative to the height (or depth) of previous glyphs in the
following cases:
(1) The bottom of the character is higher than this value. In
this case, the character is drawn above the previous glyphs.
(2) The top of the character is lower than 0 (i.e. baseline
height). In this case, the character is drawn beneath the
previous glyphs.
This value is taken from a private font property
`_MULE_RELATIVE_COMPOSE' which is introduced by Emacs. */
int relative_compose;
/* Non zero means an ascent value to be used for a character
registered in char-table `use-default-ascent'. */
int default_ascent;
/* CCL program to calculate code points of the font. */
struct ccl_program *font_encoder;
struct font_driver *driver;
};
struct font_metrics
{
short lbearing, rbearing, width, ascent, descent;
};
struct font_driver
{
/* List fonts matching with SPEC on frame F. The value is a list
of font-entity. */
Lisp_Object (*list) P_ ((FRAME_PTR f, Lisp_Object spec));
/* Open a font specified by ENTITY with SIZE on frame F. */
struct font_info *(*open) P_ ((FRAME_PTR f, Lisp_Object entity, int size));
struct font_info *(*get_info) P_ ((FRAME_PTR f, int font_idx));
int (*check) P_ ((FRAME_PTR f, struct font_info *font));
unsigned (*encode_char) P_ ((struct font_info *font, int c));
int (*glyph_metric) P_ ((struct font_info *font, unsigned code,
struct font_metrics *metrics));
int (*text_metric) P_ ((FRAME_PTR f, struct font_info *font,
unsigned *code, int nglyphs,
struct font_metrics *metrics));
int (*draw) P_ ((FRAME_PTR f, struct font_info *font, void *gc,
int x, int y, unsigned *code, int nglyphs, int as_image));
};
extern void update_font_sort_order P_ ((int order[FONT_SKEY_MAX]));
extern Lisp_Object list_fonts P_ ((FRAME_PTR f, Lisp_Object spec));
extern void syms_of_xfont P_ (());
extern void syms_of_freetype P_ (());
extern void syms_of_bdffont P_ (());
extern void syms_of_w32font P_ (());
extern void syms_of_atmfont P_ (());
#endif /* not FONT_H_INCLUDED */