File: x_font.h

package info (click to toggle)
mlterm 3.1.2-1.3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 23,168 kB
  • sloc: ansic: 102,795; sh: 9,676; java: 2,018; perl: 1,601; makefile: 1,595; cpp: 771; sed: 16
file content (133 lines) | stat: -rw-r--r-- 3,171 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 *	$Id$
 */

#ifndef  __X_FONT_H__
#define  __X_FONT_H__


/* X11/Xlib.h must be included ahead of Xft.h on XFree86-4.0.x or before. */
#include  "x.h"

#ifdef  USE_WIN32GUI
#include  <mkf/mkf_conv.h>
#endif

#include  <kiklib/kik_types.h>	/* u_int */
#include  <mkf/mkf_charset.h>	/* mkf_charset_t */
#include  <ml_font.h>

#include  "x_type_engine.h"


typedef enum x_font_present
{
	FONT_VAR_WIDTH = 0x1 ,
	FONT_VERTICAL = 0x2 ,
	FONT_AA = 0x4 ,
	FONT_NOAA = 0x8 ,	/* Don't specify with FONT_AA */

} x_font_present_t ;

typedef struct _XftFont *  xft_font_ptr_t ;
typedef struct _cairo_scaled_font *  cairo_scaled_font_ptr_t ;

/* defined in xlib/x_decsp_font.h */
typedef struct x_decsp_font *  x_decsp_font_ptr_t ;

typedef struct x_font
{
	/*
	 * Private
	 */
	Display *  display ;
	
	/*
	 * Public(readonly)
	 */
	ml_font_t  id ;

#ifdef  USE_WIN32GUI
	Font  fid ;
	mkf_conv_t *  conv ;
#else
#if  ! defined(NO_DYNAMIC_LOAD_TYPE) || defined(USE_TYPE_XFT)
	xft_font_ptr_t  xft_font ;
#endif
#if  ! defined(NO_DYNAMIC_LOAD_TYPE) || defined(USE_TYPE_CAIRO)
	cairo_scaled_font_ptr_t  cairo_font ;
#endif
#if  ! defined(NO_DYNAMIC_LOAD_TYPE) || defined(USE_TYPE_XCORE)
	XFontStruct *  xfont ;
#endif
#endif

	x_decsp_font_ptr_t  decsp_font ;

	/*
	 * These members are never zero.
	 */
	u_int8_t  cols ;
	u_int8_t  width ;
	u_int8_t  height ;
	u_int8_t  ascent ;

	/* This is not zero only when is_proportional is true and xfont is set. */
	int8_t  x_off ;

	/*
	 * If is_var_col_width is false and is_proportional is true,
	 * characters are drawn one by one. (see {xft_}draw_str())
	 */
	int8_t  is_var_col_width ;
	int8_t  is_proportional ;
	int8_t  is_vertical ;
	int8_t  is_double_drawing ;

} x_font_t ;


int  x_compose_dec_special_font(void) ;

x_font_t *  x_font_new( Display *  display , ml_font_t  id , x_type_engine_t  type_engine ,
	x_font_present_t  font_present , const char *  fontname , u_int  fontsize ,
	u_int  col_width , int  use_medium_for_bold , u_int  letter_space) ;

int  x_font_delete( x_font_t *  font) ;

int  x_font_set_font_present( x_font_t *  font , x_font_present_t  font_present) ;

int  x_font_load_xft_font( x_font_t *  font , char *  fontname , u_int  fontsize ,
	u_int  col_width , int  use_medium_for_bold) ;
	
int  x_font_load_xfont( x_font_t *  font , char *  fontname , u_int  fontsize ,
	u_int  col_width , int  use_medium_for_bold) ;

int  x_change_font_cols( x_font_t *  font , u_int  cols) ;

u_int  x_calculate_char_width( x_font_t *  font ,
		const u_char *  ch , size_t  len , mkf_charset_t  cs) ;

char **  x_font_get_encoding_names( mkf_charset_t  cs) ;

void  x_font_use_point_size_for_fc( int  bool) ;

void  x_font_set_dpi_for_fc( double  dpi) ;

#if  ! defined(NO_DYNAMIC_LOAD_TYPE) || defined(USE_TYPE_XFT) || defined(USE_TYPE_CAIRO)
int  x_use_cp932_ucs_for_xft(void) ;

int  x_convert_to_xft_ucs4( u_char *  ucs4_bytes , const u_char *  src_bytes , size_t  src_size ,
	mkf_charset_t  cs) ;
#endif

#if  ! defined(NO_DYNAMIC_LOAD_TYPE) || defined(USE_TYPE_XCORE)
size_t  x_convert_ucs4_to_utf16( u_char *  utf16 , u_char *  ucs) ;
#endif

#ifdef  DEBUG
int  x_font_dump( x_font_t *  font) ;
#endif


#endif