asfont.c File Reference

#include "config.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <ft2build.h>
#include <freetype/freetype.h>
#include "afterbase.h"
#include "asfont.h"
#include "asimage.h"
#include "asvisual.h"

Go to the source code of this file.

Classes

struct  ASGlyphMap

Defines

#define DO_X11_ANTIALIASING
#define DO_2STEP_X11_ANTIALIASING
#define DO_3STEP_X11_ANTIALIASING
#define X11_AA_HEIGHT_THRESHOLD   10
#define X11_2STEP_AA_HEIGHT_THRESHOLD   15
#define X11_3STEP_AA_HEIGHT_THRESHOLD   15
#define INCLUDE_ASFONT_PRIVATE
#define GET_KERNING(var, prev_gid, this_gid)
#define FILL_TEXT_GLYPH_MAP(name, type, getglyph, incr)
#define GET_TEXT_SIZE_LOOP(getglyph, incr, len)

Functions

void asfont_destroy (ASHashableValue value, void *data)
ASFontManagercreate_font_manager (Display *dpy, const char *font_path, ASFontManager *reusable_memory)
void destroy_font_manager (ASFontManager *fontman, Bool reusable)
static int load_freetype_glyphs (ASFont *font)
static int load_X11_glyphs (Display *dpy, ASFont *font, XFontStruct *xfs)
static ASFontopen_freetype_font_int (ASFontManager *fontman, const char *font_string, int face_no, int size, Bool verbose, ASFlagType flags)
ASFontopen_freetype_font (ASFontManager *fontman, const char *font_string, int face_no, int size, Bool verbose)
static ASFontopen_X11_font_int (ASFontManager *fontman, const char *font_string, ASFlagType flags)
ASFontopen_X11_font (ASFontManager *fontman, const char *font_string)
ASFontget_asfont (ASFontManager *fontman, const char *font_string, int face_no, int size, ASFontType type_and_flags)
ASFontdup_asfont (ASFont *font)
int release_font (ASFont *font)
static void free_glyph_data (register ASGlyph *asg)
static void destroy_glyph_range (ASGlyphRange **pgr)
static void destroy_font (ASFont *font)
void asglyph_destroy (ASHashableValue value, void *data)
static unsigned char * compress_glyph_pixmap (unsigned char *src, unsigned char *buffer, unsigned int width, unsigned int height, int src_step)
void antialias_glyph (unsigned char *buffer, unsigned int width, unsigned int height)
static void scale_down_glyph_width (unsigned char *buffer, int from_width, int to_width, int height)
static ASGlyphRangesplit_X11_glyph_range (unsigned int min_char, unsigned int max_char, XCharStruct *chars)
void load_X11_glyph_range (Display *dpy, ASFont *font, XFontStruct *xfs, size_t char_offset, unsigned char byte1, unsigned char min_byte2, unsigned char max_byte2, GC *gc)
void make_X11_default_glyph (ASFont *font, XFontStruct *xfs)
static void load_glyph_freetype (ASFont *font, ASGlyph *asg, int glyph, UNICODE_CHAR uc)
static ASGlyphRangesplit_freetype_glyph_range (unsigned long min_char, unsigned long max_char, FT_Face face)
static ASGlyphload_freetype_locale_glyph (ASFont *font, UNICODE_CHAR uc)
static void load_freetype_locale_glyphs (unsigned long min_char, unsigned long max_char, ASFont *font)
static ASGlyphget_unicode_glyph (const UNICODE_CHAR uc, ASFont *font)
static ASGlyphget_character_glyph (const unsigned char c, ASFont *font)
static UNICODE_CHAR utf8_to_unicode (const unsigned char *s)
static ASGlyphget_utf8_glyph (const char *utf8, ASFont *font)
static void apply_text_3D_type (ASText3DType type, int *width, int *height)
static unsigned int goto_tab_stop (ASTextAttributes *attr, unsigned int space_size, unsigned int line_width)
 FILL_TEXT_GLYPH_MAP (fill_text_glyph_map_Char, FILL_TEXT_GLYPH_MAP(char, get_character_glyph(text[i], font))
static int get_text_length (ASCharType char_type, const char *text)
ASGlyph ** get_text_glyph_list (const char *text, ASFont *font, ASCharType char_type, int length)
static Bool get_text_glyph_map (const char *text, ASFont *font, ASGlyphMap *map, ASTextAttributes *attr, int length)
static Bool get_text_size_internal (const char *src_text, ASFont *font, ASTextAttributes *attr, unsigned int *width, unsigned int *height, int length, int *x_positions)
Bool get_text_size (const char *src_text, ASFont *font, ASText3DType type, unsigned int *width, unsigned int *height)
Bool get_unicode_text_size (const UNICODE_CHAR *src_text, ASFont *font, ASText3DType type, unsigned int *width, unsigned int *height)
Bool get_utf8_text_size (const char *src_text, ASFont *font, ASText3DType type, unsigned int *width, unsigned int *height)
Bool get_fancy_text_size (const void *src_text, ASFont *font, ASTextAttributes *attr, unsigned int *width, unsigned int *height, int length, int *x_positions)
static void render_asglyph (CARD8 **scanlines, CARD8 *row, int start_x, int y, int width, int height, CARD32 ratio)
static void render_asglyph_over (CARD8 **scanlines, CARD8 *row, int start_x, int y, int width, int height, CARD32 value)
static ASImagedraw_text_internal (const char *text, ASFont *font, ASTextAttributes *attr, int compression, int length)
ASImagedraw_text (const char *text, ASFont *font, ASText3DType type, int compression)
ASImagedraw_unicode_text (const UNICODE_CHAR *text, ASFont *font, ASText3DType type, int compression)
ASImagedraw_utf8_text (const char *text, ASFont *font, ASText3DType type, int compression)
ASImagedraw_fancy_text (const void *text, ASFont *font, ASTextAttributes *attr, int compression, int length)
Bool get_asfont_glyph_spacing (ASFont *font, int *x, int *y)
Bool set_asfont_glyph_spacing (ASFont *font, int x, int y)
void print_asfont (FILE *stream, ASFont *font)
void print_asglyph (FILE *stream, ASFont *font, unsigned long c)
Bool afterimage_uses_xrender ()
void draw_text_xrender (ASVisual *asv, const void *text, ASFont *font, ASTextAttributes *attr, int length, int xrender_op, unsigned long xrender_src, unsigned long xrender_dst, int xrender_xSrc, int xrender_ySrc, int xrender_xDst, int xrender_yDst)


Define Documentation

#define DO_2STEP_X11_ANTIALIASING

Definition at line 29 of file asfont.c.

#define DO_3STEP_X11_ANTIALIASING

Definition at line 30 of file asfont.c.

#define DO_X11_ANTIALIASING

Definition at line 28 of file asfont.c.

#define FILL_TEXT_GLYPH_MAP ( name,
type,
getglyph,
incr   ) 

Definition at line 1454 of file asfont.c.

#define GET_KERNING ( var,
prev_gid,
this_gid   ) 

Value:

do{ if( (prev_gid) != 0 && font->type == ASF_Freetype && get_flags(font->flags, ASF_Monospaced|ASF_HasKerning) == ASF_HasKerning ) { \
                FT_Vector delta; \
                FT_Get_Kerning( font->ft_face, (prev_gid), (this_gid), FT_KERNING_DEFAULT, &delta );\
                (var) = (short)(delta.x >> 6); \
        }}while(0)

Definition at line 1442 of file asfont.c.

#define GET_TEXT_SIZE_LOOP ( getglyph,
incr,
len   ) 

Value:

do{ Bool terminated = True; ++i ;\
                if( len == 0 || i < len )       \
                {       terminated = ( text[i] == '\0' || text[i] == '\n' ); \
                        if( x_positions ) x_positions[i] = line_width ; \
                } \
                if( terminated ) { \
                        if( last_asg && last_asg->width+last_asg->lead > last_asg->step ) \
                                line_width += last_asg->width+last_asg->lead - last_asg->step ; \
                        last_asg = NULL; last_gid = 0 ; \
                        if( line_width > w ) \
                                w = line_width ; \
                        line_width = 0 ; \
            ++line_count ; \
                }else { \
                        last_asg = NULL ; \
                        if( text[i] == ' ' ){ \
                                line_width += space_size ; last_gid = 0 ;\
                        }else if( text[i] == '\t' ){ last_gid = 0 ; \
                                if( !get_flags(attr->rendition_flags, ASTA_UseTabStops) ) line_width += space_size*attr->tab_size ; \
                                else line_width = goto_tab_stop( attr, space_size, line_width ); \
                        }else{ int kerning = 0 ;\
                                last_asg = getglyph; \
                                GET_KERNING(kerning,last_gid,last_asg->font_gid); \
                                if( line_width < -last_asg->lead ) line_width -= (line_width+last_asg->lead);\
                                line_width += last_asg->step+offset_3d_x +kerning ;  \
                                last_gid = last_asg->font_gid ; \
                                incr ; \
                        } \
                } \
        }while( (len <= 0 || len > i) && text[i] != '\0' )

Definition at line 1629 of file asfont.c.

Referenced by get_text_size_internal().

#define INCLUDE_ASFONT_PRIVATE

Definition at line 76 of file asfont.c.

#define X11_2STEP_AA_HEIGHT_THRESHOLD   15

Definition at line 32 of file asfont.c.

Referenced by antialias_glyph().

#define X11_3STEP_AA_HEIGHT_THRESHOLD   15

Definition at line 33 of file asfont.c.

Referenced by antialias_glyph().

#define X11_AA_HEIGHT_THRESHOLD   10

Definition at line 31 of file asfont.c.

Referenced by load_X11_glyph_range().


Function Documentation

Bool afterimage_uses_xrender (  ) 

Definition at line 2239 of file asfont.c.

References False.

void antialias_glyph ( unsigned char *  buffer,
unsigned int  width,
unsigned int  height 
)

Definition at line 520 of file asfont.c.

References c, int, row, x, X11_2STEP_AA_HEIGHT_THRESHOLD, X11_3STEP_AA_HEIGHT_THRESHOLD, and y.

Referenced by load_X11_glyph_range().

static void apply_text_3D_type ( ASText3DType  type,
int *  width,
int *  height 
) [static]

Definition at line 1392 of file asfont.c.

References AST_Embossed, AST_EmbossedThick, AST_OutlineAbove, AST_OutlineBelow, AST_OutlineFull, AST_ShadeAbove, AST_ShadeBelow, AST_Sunken, and AST_SunkenThick.

Referenced by draw_text_internal(), get_text_glyph_map(), and get_text_size_internal().

void asfont_destroy ( ASHashableValue  value,
void *  data 
)

Definition at line 439 of file asfont.c.

References data, destroy_font(), free(), MAGIC_ASFONT, name, and NULL.

Referenced by create_font_manager().

void asglyph_destroy ( ASHashableValue  value,
void *  data 
)

Definition at line 429 of file asfont.c.

References free(), and free_glyph_data().

Referenced by load_freetype_locale_glyph(), and load_freetype_locale_glyphs().

static unsigned char* compress_glyph_pixmap ( unsigned char *  src,
unsigned char *  buffer,
unsigned int  width,
unsigned int  height,
int  src_step 
) [static]

Definition at line 462 of file asfont.c.

References i, k, safemalloc, and x80.

Referenced by load_glyph_freetype(), load_X11_glyph_range(), and make_X11_default_glyph().

ASFontManager* create_font_manager ( Display *  dpy,
const char *  font_path,
ASFontManager reusable_memory 
)

Definition at line 105 of file asfont.c.

References asfont_destroy(), create_ashash, ASFontManager::dpy, ASFontManager::font_path, ASFontManager::fonts_hash, FT_Init_FreeType(), ASFontManager::ft_ok, LOCAL_DEBUG_OUT, mystrdup, NULL, safecalloc, show_error, string_compare, string_hash_value, and True.

Referenced by create_generic_fontman(), and TASImage::DrawText().

static void destroy_font ( ASFont font  )  [static]

Definition at line 408 of file asfont.c.

References ASF_Freetype, ASFont::codemap, ASFont::default_glyph, destroy_ashash, destroy_glyph_range(), free(), free_glyph_data(), FT_Done_Face(), ASFont::locale_glyphs, ASFont::magic, ASFont::name, and ASFont::type.

Referenced by asfont_destroy().

void destroy_font_manager ( ASFontManager fontman,
Bool  reusable 
)

Definition at line 131 of file asfont.c.

References destroy_ashash, False, ASFontManager::font_path, ASFontManager::fonts_hash, free(), FT_Done_FreeType(), and ASFontManager::ft_ok.

Referenced by compose_asimage_xml_from_doc().

static void destroy_glyph_range ( ASGlyphRange **  pgr  )  [static]

Definition at line 380 of file asfont.c.

References free(), free_glyph_data(), gr, i, int, and NULL.

Referenced by destroy_font().

ASImage* draw_fancy_text ( const void *  text,
ASFont font,
ASTextAttributes attr,
int  compression,
int  length 
)

Definition at line 2138 of file asfont.c.

References ARGB32_White, ASCT_Char, ASCT_UTF8, ASTA_VERSION_INTERNAL, ASTextAttributes::char_type, draw_text_internal(), IsUTF8Locale, NULL, ASTextAttributes::tab_size, and ASTextAttributes::version.

Referenced by handle_asxml_tag_text().

ASImage* draw_text ( const char *  text,
ASFont font,
ASText3DType  type,
int  compression 
)

Definition at line 2112 of file asfont.c.

References ARGB32_White, ASCT_Char, ASCT_UTF8, ASTA_VERSION_INTERNAL, ASTextAttributes::char_type, draw_text_internal(), IsUTF8Locale, NULL, and ASTextAttributes::type.

Referenced by TASImage::DrawText().

static ASImage* draw_text_internal ( const char *  text,
ASFont font,
ASTextAttributes attr,
int  compression,
int  length 
) [static]

Definition at line 1859 of file asfont.c.

References apply_text_3D_type(), ARGB32_BLUE16, ARGB32_GREEN16, ARGB32_RED16, ASF_Monospaced, AST_OutlineAbove, create_asimage(), fc, ASFont::flags, ASTextAttributes::fore_color, get_flags, get_text_glyph_map(), get_text_size(), ASGlyphMap::height, height, LOCAL_DEBUG_CALLER_OUT, LOCAL_DEBUG_OUT, ASFont::max_ascend, ASFont::max_height, NULL, safecalloc, safemalloc, scanlines, ASFont::space_size, ASFont::spacing_x, ASFont::spacing_y, START_TIME, ASTextAttributes::type, ASGlyphMap::width, ASTextAttributes::width, and width.

Referenced by draw_fancy_text(), draw_text(), draw_unicode_text(), and draw_utf8_text().

void draw_text_xrender ( ASVisual asv,
const void *  text,
ASFont font,
ASTextAttributes attr,
int  length,
int  xrender_op,
unsigned long  xrender_src,
unsigned long  xrender_dst,
int  xrender_xSrc,
int  xrender_ySrc,
int  xrender_xDst,
int  xrender_yDst 
)

Definition at line 2242 of file asfont.c.

ASImage* draw_unicode_text ( const UNICODE_CHAR *  text,
ASFont font,
ASText3DType  type,
int  compression 
)

Definition at line 2122 of file asfont.c.

References ARGB32_White, ASCT_Unicode, ASTA_VERSION_INTERNAL, draw_text_internal(), NULL, and ASTextAttributes::type.

ASImage* draw_utf8_text ( const char *  text,
ASFont font,
ASText3DType  type,
int  compression 
)

Definition at line 2130 of file asfont.c.

References ARGB32_White, ASCT_UTF8, ASTA_VERSION_INTERNAL, draw_text_internal(), NULL, and ASTextAttributes::type.

ASFont* dup_asfont ( ASFont font  ) 

Definition at line 341 of file asfont.c.

References ASFont::fontman, NULL, and ASFont::ref_count.

FILL_TEXT_GLYPH_MAP ( fill_text_glyph_map_Char  ,
FILL_TEXT_GLYPH_MAP(  char,
get_character_glyph(text[i], font)   
)

Definition at line 1510 of file asfont.c.

References free().

static void free_glyph_data ( register ASGlyph asg  )  [inline, static]

Definition at line 371 of file asfont.c.

References free(), and NULL.

Referenced by asglyph_destroy(), destroy_font(), and destroy_glyph_range().

ASFont* get_asfont ( ASFontManager fontman,
const char *  font_string,
int  face_no,
int  size,
ASFontType  type_and_flags 
)

Definition at line 286 of file asfont.c.

References add_hash_item, AS_HASHABLE, ASF_Freetype, ASF_GuessWho, ASF_TypeMask, ASH_Success, False, ASFontManager::fonts_hash, free(), get_flags, get_hash_item, len, mystrdup, ASFont::name, NULL, open_freetype_font_int(), open_X11_font_int(), ASFont::ref_count, safemalloc, sprintf(), True, type, and ASHashData::vptr.

Referenced by TASImage::DrawText(), and handle_asxml_tag_text().

Bool get_asfont_glyph_spacing ( ASFont font,
int *  x,
int *  y 
)

Definition at line 2155 of file asfont.c.

References False, ASFont::spacing_x, ASFont::spacing_y, and True.

static ASGlyph* get_character_glyph ( const unsigned char  c,
ASFont font 
) [inline, static]

Definition at line 1303 of file asfont.c.

References CHAR2UNICODE, and get_unicode_glyph().

Referenced by get_text_glyph_list(), and get_text_size_internal().

Bool get_fancy_text_size ( const void *  src_text,
ASFont font,
ASTextAttributes attr,
unsigned int *  width,
unsigned int *  height,
int  length,
int *  x_positions 
)

Definition at line 1759 of file asfont.c.

References ASCT_Char, ASCT_UTF8, ASTA_VERSION_INTERNAL, ASTextAttributes::char_type, get_text_size_internal(), IsUTF8Locale, NULL, ASTextAttributes::tab_size, and ASTextAttributes::version.

ASGlyph** get_text_glyph_list ( const char *  text,
ASFont font,
ASCharType  char_type,
int  length 
)

Definition at line 1550 of file asfont.c.

References ASCT_Char, ASCT_Unicode, ASCT_UTF8, get_character_glyph(), get_text_length(), get_unicode_glyph(), get_utf8_glyph(), NULL, ptr, safecalloc, and UTF8_CHAR_SIZE.

static Bool get_text_glyph_map ( const char *  text,
ASFont font,
ASGlyphMap map,
ASTextAttributes attr,
int  length 
) [static]

Definition at line 1586 of file asfont.c.

References apply_text_3D_type(), ASCT_Unicode, ASCT_UTF8, ASF_Monospaced, ASTextAttributes::char_type, False, ASFont::flags, get_flags, get_text_length(), ASGlyphMap::glyphs, ASGlyphMap::glyphs_num, ASGlyphMap::height, ASFont::max_height, NULL, safecalloc, ASFont::space_size, ASFont::spacing_x, ASFont::spacing_y, True, ASTextAttributes::type, and ASGlyphMap::x_kerning.

Referenced by draw_text_internal().

static int get_text_length ( ASCharType  char_type,
const char *  text 
) [static]

Definition at line 1530 of file asfont.c.

References ASCT_Char, ASCT_Unicode, ASCT_UTF8, ptr, and UTF8_CHAR_SIZE.

Referenced by get_text_glyph_list(), and get_text_glyph_map().

Bool get_text_size ( const char *  src_text,
ASFont font,
ASText3DType  type,
unsigned int *  width,
unsigned int *  height 
)

Definition at line 1733 of file asfont.c.

References ASCT_Char, ASCT_UTF8, ASTA_VERSION_INTERNAL, ASTextAttributes::char_type, get_text_size_internal(), IsUTF8Locale, NULL, and ASTextAttributes::type.

Referenced by draw_text_internal(), and TASImage::DrawText().

static Bool get_text_size_internal ( const char *  src_text,
ASFont font,
ASTextAttributes attr,
unsigned int *  width,
unsigned int *  height,
int  length,
int *  x_positions 
) [static]

Definition at line 1662 of file asfont.c.

References apply_text_3D_type(), ASCT_Char, ASCT_Unicode, ASCT_UTF8, ASF_Monospaced, ASTextAttributes::char_type, False, ASFont::flags, get_character_glyph(), get_flags, GET_TEXT_SIZE_LOOP, get_unicode_glyph(), get_utf8_glyph(), h, k, LOCAL_DEBUG_OUT, ASFont::max_height, NULL, ASFont::space_size, ASFont::spacing_x, ASFont::spacing_y, text(), True, ASTextAttributes::type, UTF8_CHAR_SIZE, and w.

Referenced by get_fancy_text_size(), get_text_size(), get_unicode_text_size(), and get_utf8_text_size().

static ASGlyph* get_unicode_glyph ( const UNICODE_CHAR  uc,
ASFont font 
) [inline, static]

Definition at line 1271 of file asfont.c.

References AS_HASHABLE, ASH_Success, ASFont::codemap, ASFont::default_glyph, get_hash_item, load_freetype_locale_glyph(), LOCAL_DEBUG_OUT, ASFont::locale_glyphs, NULL, ASGlyph::pixmap, ASHashData::vptr, and ASGlyph::width.

Referenced by get_character_glyph(), get_text_glyph_list(), get_text_size_internal(), get_utf8_glyph(), and print_asglyph().

Bool get_unicode_text_size ( const UNICODE_CHAR *  src_text,
ASFont font,
ASText3DType  type,
unsigned int *  width,
unsigned int *  height 
)

Definition at line 1743 of file asfont.c.

References ASCT_Unicode, ASTA_VERSION_INTERNAL, get_text_size_internal(), NULL, and ASTextAttributes::type.

static ASGlyph* get_utf8_glyph ( const char *  utf8,
ASFont font 
) [inline, static]

Definition at line 1371 of file asfont.c.

References get_unicode_glyph(), LOCAL_DEBUG_OUT, UNICODE_CHAR, UTF8_CHAR_SIZE, and utf8_to_unicode().

Referenced by get_text_glyph_list(), and get_text_size_internal().

Bool get_utf8_text_size ( const char *  src_text,
ASFont font,
ASText3DType  type,
unsigned int *  width,
unsigned int *  height 
)

Definition at line 1751 of file asfont.c.

References ASCT_UTF8, ASTA_VERSION_INTERNAL, get_text_size_internal(), NULL, and ASTextAttributes::type.

static unsigned int goto_tab_stop ( ASTextAttributes attr,
unsigned int  space_size,
unsigned int  line_width 
) [static]

Definition at line 1422 of file asfont.c.

References i, NULL, ASTextAttributes::origin, ASTextAttributes::tab_size, ASTextAttributes::tab_stops, and ASTextAttributes::tab_stops_num.

static int load_freetype_glyphs ( ASFont font  )  [static]

Definition at line 1208 of file asfont.c.

References ASGlyph::ascend, CHAR2UNICODE, ASFont::codemap, ASFont::default_glyph, ASGlyph::descend, FT_Get_Char_Index(), i, load_freetype_locale_glyphs(), load_glyph_freetype(), MAX, ASFont::max_ascend, ASFont::max_descend, ASFont::max_height, NULL, safecalloc, split_freetype_glyph_range(), and UNICODE_CHAR.

Referenced by open_freetype_font_int().

static ASGlyph* load_freetype_locale_glyph ( ASFont font,
UNICODE_CHAR  uc 
) [static]

Definition at line 1163 of file asfont.c.

References add_hash_item, AS_HASHABLE, ASGlyph::ascend, asglyph_destroy(), ASH_Success, ASGlyph::descend, FT_Get_Char_Index(), load_glyph_freetype(), LOCAL_DEBUG_OUT, ASFont::locale_glyphs, ASFont::max_ascend, ASFont::max_descend, ASFont::max_height, NULL, and safecalloc.

Referenced by get_unicode_glyph(), and load_freetype_locale_glyphs().

static void load_freetype_locale_glyphs ( unsigned long  min_char,
unsigned long  max_char,
ASFont font 
) [static]

Definition at line 1192 of file asfont.c.

References asglyph_destroy(), CHAR2UNICODE, create_ashash, i, load_freetype_locale_glyph(), LOCAL_DEBUG_CALLER_OUT, LOCAL_DEBUG_OUT, ASFont::locale_glyphs, ASFont::max_ascend, ASFont::max_descend, ASFont::max_height, and NULL.

Referenced by load_freetype_glyphs().

static void load_glyph_freetype ( ASFont font,
ASGlyph asg,
int  glyph,
UNICODE_CHAR  uc 
) [static]

Definition at line 1007 of file asfont.c.

References ASGlyph::ascend, ASF_Monospaced, buf, FT_Bitmap_::buffer, compress_glyph_pixmap(), ASGlyph::descend, ASFont::flags, ASGlyph::font_gid, free(), FT_LOAD_DEFAULT, FT_Load_Glyph(), FT_Render_Glyph(), ft_render_mode_normal, get_flags, ASGlyph::height, i, int, k, ASGlyph::lead, LOCAL_DEBUG_OUT, NULL, FT_Bitmap_::pitch, ASGlyph::pixmap, realloc(), FT_Bitmap_::rows, scale_down_glyph_width(), short, ASFont::space_size, ASGlyph::step, FT_Bitmap_::width, width, and ASGlyph::width.

Referenced by load_freetype_glyphs(), and load_freetype_locale_glyph().

void load_X11_glyph_range ( Display *  dpy,
ASFont font,
XFontStruct *  xfs,
size_t  char_offset,
unsigned char  byte1,
unsigned char  min_byte2,
unsigned char  max_byte2,
GC *  gc 
)

Definition at line 739 of file asfont.c.

References antialias_glyph(), ASF_Monospaced, buffer, compress_glyph_pixmap(), ASFont::flags, get_flags, height, i, len, LOCAL_DEBUG_OUT, MAX, MIN, NULL, p, row, safecalloc, safemalloc, scale_down_glyph_width(), ASFont::space_size, split_X11_glyph_range(), w, width, x, X11_AA_HEIGHT_THRESHOLD, and y.

Referenced by load_X11_glyphs().

static int load_X11_glyphs ( Display *  dpy,
ASFont font,
XFontStruct *  xfs 
) [static]

Definition at line 928 of file asfont.c.

References ASF_Monospaced, ASFont::default_glyph, ASFont::flags, get_flags, i, load_X11_glyph_range(), make_X11_default_glyph(), MAX, ASFont::max_ascend, ASFont::max_descend, ASFont::max_height, MIN, NULL, ASGlyph::pixmap, size_t, and ASFont::space_size.

Referenced by open_X11_font_int().

void make_X11_default_glyph ( ASFont font,
XFontStruct *  xfs 
)

Definition at line 890 of file asfont.c.

References ASGlyph::ascend, buf, compress_glyph_pixmap(), ASFont::default_glyph, ASGlyph::descend, free(), height, ASGlyph::height, ASGlyph::lead, ASGlyph::pixmap, row, safecalloc, safemalloc, ASGlyph::step, width, ASGlyph::width, x, and y.

Referenced by load_X11_glyphs().

ASFont* open_freetype_font ( ASFontManager fontman,
const char *  font_string,
int  face_no,
int  size,
Bool  verbose 
)

Definition at line 243 of file asfont.c.

References open_freetype_font_int().

static ASFont* open_freetype_font_int ( ASFontManager fontman,
const char *  font_string,
int  face_no,
int  size,
Bool  verbose,
ASFlagType  flags 
) [static]

Definition at line 161 of file asfont.c.

References ASF_Freetype, ASF_HasKerning, find_file, ASFont::flags, ASFontManager::font_path, ASFont::fontman, free(), FT_HAS_KERNING, FT_New_Face(), ASFontManager::ft_ok, FT_Set_Pixel_Sizes(), i, load_freetype_glyphs(), LOCAL_DEBUG_OUT, ASFont::magic, MAGIC_ASFONT, MAX_GLYPHS_PER_FONT, mystrdup, NULL, R_OK, safecalloc, set_flags, show_error, show_warning, ASFont::space_size, and ASFont::type.

Referenced by get_asfont(), and open_freetype_font().

ASFont* open_X11_font ( ASFontManager fontman,
const char *  font_string 
)

Definition at line 280 of file asfont.c.

References open_X11_font_int().

static ASFont* open_X11_font_int ( ASFontManager fontman,
const char *  font_string,
ASFlagType  flags 
) [static]

Definition at line 249 of file asfont.c.

References ASF_X11, ASFontManager::dpy, ASFont::flags, ASFont::fontman, load_X11_glyphs(), ASFont::magic, MAGIC_ASFONT, NULL, safecalloc, show_warning, and ASFont::type.

Referenced by get_asfont(), and open_X11_font().

void print_asfont ( FILE *  stream,
ASFont font 
)

Definition at line 2180 of file asfont.c.

References ASFont::flags, fprintf(), ASFont::max_ascend, ASFont::max_descend, ASFont::max_height, ASFont::space_size, ASFont::spacing_x, ASFont::spacing_y, and ASFont::type.

void print_asglyph ( FILE *  stream,
ASFont font,
unsigned long  c 
)

Definition at line 2198 of file asfont.c.

References ASGlyph::ascend, ASGlyph::descend, fprintf(), get_unicode_glyph(), ASGlyph::height, k, ASGlyph::lead, NULL, ASGlyph::pixmap, ASGlyph::width, and x80.

int release_font ( ASFont font  ) 

Definition at line 351 of file asfont.c.

References ASFont::fontman, ASFontManager::fonts_hash, ASFont::magic, MAGIC_ASFONT, ASFont::name, NULL, ASFont::ref_count, remove_hash_item, and True.

Referenced by TASImage::DrawText().

static void render_asglyph ( CARD8 **  scanlines,
CARD8 *  row,
int  start_x,
int  y,
int  width,
int  height,
CARD32  ratio 
) [inline, static]

Definition at line 1777 of file asfont.c.

References data, x, and x80.

static void render_asglyph_over ( CARD8 **  scanlines,
CARD8 *  row,
int  start_x,
int  y,
int  width,
int  height,
CARD32  value 
) [inline, static]

Definition at line 1816 of file asfont.c.

References data, x, and x80.

static void scale_down_glyph_width ( unsigned char *  buffer,
int  from_width,
int  to_width,
int  height 
) [static]

Definition at line 650 of file asfont.c.

References i, k, l, ptr, and smaller.

Referenced by load_glyph_freetype(), and load_X11_glyph_range().

Bool set_asfont_glyph_spacing ( ASFont font,
int  x,
int  y 
)

Definition at line 2168 of file asfont.c.

References False, ASFont::spacing_x, ASFont::spacing_y, and True.

Referenced by handle_asxml_tag_text().

static ASGlyphRange* split_freetype_glyph_range ( unsigned long  min_char,
unsigned long  max_char,
FT_Face  face 
) [static]

Definition at line 1140 of file asfont.c.

References CHAR2UNICODE, FT_Get_Char_Index(), i, LOCAL_DEBUG_CALLER_OUT, LOCAL_DEBUG_OUT, NULL, and safecalloc.

Referenced by load_freetype_glyphs().

static ASGlyphRange* split_X11_glyph_range ( unsigned int  min_char,
unsigned int  max_char,
XCharStruct *  chars 
) [static]

Definition at line 716 of file asfont.c.

References c, LOCAL_DEBUG_CALLER_OUT, LOCAL_DEBUG_OUT, NULL, safecalloc, and width.

Referenced by load_X11_glyph_range().

static UNICODE_CHAR utf8_to_unicode ( const unsigned char *  s  )  [static]

Definition at line 1309 of file asfont.c.

References c, UNICODE_CHAR, x01, x03, x07, x80, x84, x88, and x90.

Referenced by get_utf8_glyph().


Generated on Tue Jul 5 15:57:44 2011 for ROOT_528-00b_version by  doxygen 1.5.1