/* font.h -- header file for the font module.
- Copyright (C) 2003, 2004
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H15PRO112
You should have received a copy of the GNU Lesser General Public
License along with the m17n library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
02111-1307, USA. */
#ifndef _M17N_FONT_H_
For the time being, we mention only Y-resolution (resy) and
assume that resx is always equal to resy. */
unsigned short property[MFONT_PROPERTY_MAX];
- enum MFontType type : 2;
- enum MFontSource source : 2;
- enum MFontSpacing spacing : 2;
- /* Size of the font in 1/10 pixels. */
- unsigned size : 26;
+ unsigned type : 2;
+ unsigned source : 2;
+ unsigned spacing : 2;
+ unsigned for_full_width : 1;
+ /* For FONT-OBJ, 1 means `size' is a logical or of bit masks for
+ available pixel sizes (Nth bit corresponds to (6 + N) pixels), 0
+ means `size' is an actual pixel size * 10. For FONT-SPEC and
+ FONT-OPENED, this is always 0, and `size' is an actual pixel
+ size * 10. */
+ unsigned multiple_sizes : 1;
+ unsigned size : 24;
MSymbol file;
MSymbol capability;
MFontEncoding *encoding;
so that this object can be distingushed from MFont. */
MFont spec;
+ /* Font identifier. */
+ MSymbol id;
+
/* Frame on which the font is realized. */
MFrame *frame;
carry the infomation. */
MSymbol layouter;
+ /* 1 iff the font is opend by encapsulating client-side font data. */
+ int encapsulating;
+
/* Extra information set by MRealizedFont::driver->open. If
non-NULL, it must be a pointer to a managed object. */
void *info;
- int ascent, descent, max_advance;
+ int x_ppem, y_ppem;
+
+ int ascent, descent, max_advance, average_width, baseline_offset;
/* Pointer to the font structure. */
void *fontp;
MRealizedFont *next;
};
+typedef struct MFLTFontForRealized {
+ MFLTFont font;
+ MRealizedFont *rfont;
+} MFLTFontForRealized;
+
typedef struct {
MFont *font;
int score;
0 limits the number of listed fonts. Return the number of fonts
listed. */
int (*list) (MFrame *frame, MPlist *plist, MFont *font, int maxnum);
+
+ /** Push to PLIST font family names (symbol) available on FRAME. */
+ void (*list_family_names) (MFrame *frame, MPlist *plist);
+
+ /** Check if RFONT support CAPABILITY. */
+ int (*check_capability) (MRealizedFont *rfont, MSymbol capability);
+
+ /** Open a font by encapsulating DATA. */
+ MRealizedFont *(*encapsulate) (MFrame *frame, MSymbol source, void *data);
+
+ void (*close) (MRealizedFont *rfont);
+
+ int (*check_otf) (MFLTFont *font, MFLTOtfSpec *spec);
+
+ int (*drive_otf) (MFLTFont *font, MFLTOtfSpec *spec,
+ MFLTGlyphString *in, int from, int to,
+ MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment);
+
+ int (*try_otf) (MFLTFont *font, MFLTOtfSpec *spec,
+ MFLTGlyphString *in, int from, int to);
+
+ int (*iterate_otf_feature) (struct _MFLTFont *font, MFLTOtfSpec *spec,
+ int from, int to, unsigned char *table);
};
/** Initialize the members of FONT. */
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
+#endif
#ifdef HAVE_FONTCONFIG
#include <fontconfig/fontconfig.h>
typedef struct
{
M17NObject control;
- MSymbol *lang;
+ MSymbol language;
MSymbol script;
+ MSymbol otf;
OTF_Tag script_tag;
-#ifdef HAVE_OTF
OTF_Tag langsys_tag;
struct {
char *str;
int nfeatures;
OTF_Tag *tags;
} features[MFONT_OTT_MAX];
-#endif
} MFontCapability;
+#ifdef HAVE_FREETYPE
extern MFontDriver mfont__ft_driver;
extern int mfont__ft_init ();
extern MSymbol mfont__set_spec_from_plist (MFont *spec, MPlist *plist);
-extern void mfont__resize (MFont *spec, MFont *request);
-
extern int mfont__has_char (MFrame *frame, MFont *font, MFont *spec, int c);
extern unsigned mfont__encode_char (MFrame *frame, MFont *font, MFont *spec,
int c);
+extern int mfont__get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring,
+ int from, int to);
+
extern MFont *mfont__select (MFrame *frame, MFont *font, int max_size);
extern MFontList *mfont__list (MFrame *frame, MFont *spec, MFont *request,
extern void mfont__get_metric (MGlyphString *gstring, int from, int to);
+extern int mfont__get_metrics (MFLTFont *font, MFLTGlyphString *gstring,
+ int from, int to);
+
extern void mfont__set_property (MFont *font, enum MFontProperty key,
MSymbol val);
extern MFontCapability *mfont__get_capability (MSymbol sym);
+extern int mfont__check_capability (MRealizedFont *rfont, MSymbol capability);
+
extern unsigned mfont__flt_encode_char (MSymbol layouter_name, int c);
extern int mfont__flt_run (MGlyphString *gstring, int from, int to,