/usr/share/doc/libafterimage-dev/html/asfont.html is in libafterimage-dev 2.2.12-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>ASFont</title>
<style type="text/css">
<!--
body {
margin-top: 5px;
background-repeat: repeat;
}
.copy {
margin-top: 10px;
margin-left: 4%;
margin-right: 4%;
}
.copy a:link, .copy a:visited {
color:#0FF;
text-decoration:none
}
.copy a:active, .copy a:hover {
color:#FC3;
text-decoration:underline
}
.copy2 {
margin-top: 10px;
margin-left: 0;
margin-right: 0;
}
.copy2 a:link, .copy a:visited {
color:#0FF;
text-decoration:none
}
.copy2 a:active, .copy a:hover {
color:#FC3;
text-decoration:underline
}
p.codeBlock {
background: #444444;
padding: 1em;
margin-left: 4em;
font-family:Tahoma, Arial, Verdana, Helvetica;
font-size:14px;
}
.container {
padding: -1em;
margin-left: 0em;
margin-right: 1em;
width: 100%;
background: #ccc;
border: 1px solid #000;
font-size:13px;
}
p.dense {
text-align: justify;
margin-top: 0em;
padding: 0em;
line-height: 110%;
}
p.sect_header
{
background-color: #dddddd;
color: #000000;
text-align: right;
font-size: 11pt;
}
p.refsect_header
{
text-align: left;
font-size: 14px;
line-height: 90%;
}
dl.dense {
padding: 0;
margin: 0;
font-size:14px;
}
ul.dense {
}
li.dense {
line-height: 110%;
}
dt.dense {
line-height: 110%;
text-align: bottom;
}
dd.dense {
font-size:14px;
}
-->
</style>
</head>
<body>
<A name="page_top"></A>
<A href="../../afterstep/html/preface.html">Preface</A> <A href="../../afterstep/html/visualselect.html">Introduction</A> <A href="../../afterstep/html/index.html">Main index</A> <A href="index.html">API Topic index</A> <A href="Glossary.html">API Glossary</A><p>
<h1>ASFont</h1><font size=4>text drawing functionality and handling of TTF and X11 fonts</font><hr>
<A NAME="libAfterImage/asfont.h"><UL><p class="sect_header"><B>libAfterImage/asfont.h</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="asfont"></A><B>asfont</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Text drawing functionality.
Text is drawn as an <A href="asimage.html#ASImage">ASImage</A> with only alpha channel. Since alpha
channel is 8 bit widths that allows for 256 shades to be used in
rendered glyphs. That in turn allows for smoothing and antialiasing
of the drawn <A href="asimagexml.html#text">text</A>. Such an approcah allows for easy manipulation of
the drawn <A href="asimagexml.html#text">text</A>, such as changing <A href="asimagexml.html#color">color</A>, making it transparent,
texturizing, rotation, etc.
<A href="afterimage.html#libAfterImage">libAfterImage</A> supports two types of fonts :
Fonts that could be rendered using standard Xlib functionality, and
fonts rendered by FreeType 2 library. That may include TrueType
fonts. When fonts are obtained via Xlib special processing is
performed in order to smooth its shape and leverage 256 shades
palette available.
Any font being used is has to be opened first. At that time its
properties are analysed and glyphs are cached in clients memory.
Special RLE compression method is used for font glyphs, significantly
reducing memory utilization without any effect on performance.
Font management and drawing functionality has been designed with
internatiolization in mind, althou support for locales is not
complete yet.
</PRE></LI><LI><p class="refsect_header"><B>SEE ALSO</B></p><PRE>Structures :
<A href="asfont.html#ASFontManager">ASFontManager</A>
<A href="asfont.html#ASFont">ASFont</A>
<A href="asfont.html#ASGlyph">ASGlyph</A>
<A href="asfont.html#ASGlyphRange">ASGlyphRange</A>
Functions :
create_font_manager(), destroy_font_manager(),
open_freetype_font(), open_X11_font(), get_asfont(),
destroy_font(), print_asfont(), print_asglyph(),
draw_text(),
get_asfont_glyph_spacing(), set_asfont_glyph_spacing()
Other <A href="afterimage.html#libAfterImage">libAfterImage</A> modules :
<A href="ascmap.html#ascmap">ascmap</A>.h <A href="asfont.html#asfont">asfont</A>.h <A href="asimage.html#asimage">asimage</A>.h <A href="asvisual.html#asvisual">asvisual</A>.h <A href="blender.html#blender">blender</A>.h <A href="export.html#export">export</A>.h
<A href="import.html#import">import</A>.h <A href="transform.html#transform">transform</A>.h <A href="ximage.html#ximage">ximage</A>.h
</PRE></LI><LI><p class="refsect_header"><B>AUTHOR</B></p><PRE>Sasha Vasko <sasha at aftercode dot net>
</PRE></LI></UL>
<A NAME="libAfterImage/MAX_GLYPHS_PER_FONT"><UL><p class="sect_header"><B>libAfterImage/MAX_GLYPHS_PER_FONT</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="MAX_GLYPHS_PER_FONT"></A><B>MAX_GLYPHS_PER_FONT</B><P class="dense">- Max <A href="blender.html#value_scanlines()">value</A> of glyphs per font allowed.
We need that so we can detect and avoid broken fonts somehow.
</P></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
#define MAX_GLYPHS_PER_FONT 2048
</PRE></div><br></p></LI></UL>
<A NAME="libAfterImage/ASFontType"><UL><p class="sect_header"><B>libAfterImage/ASFontType</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASFontType"></A><B>ASFontType</B><P class="dense">- Supported types of fonts - Xlib or FreeType 2
ASF_GuessWho will enable autodetection of the font type.
It is attempted to be opened as FreeType font first, and <A href="asimagexml.html#if">if</A> that
fails - it will be opened as Xlib font.
</P></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef enum
{
ASF_X11 = 0,
ASF_Freetype = (0x01<<0),
ASF_GuessWho = (0x01<<1),
#define ASF_TypeMask (ASF_GuessWho|ASF_Freetype)
/* flags below should be combined with one of the above values */
ASF_Monospaced = (0x01<<2),
ASF_RightToLeft = (0x01<<3), /* direction of the <A href="asimagexml.html#text">text</A> flow */
ASF_HasKerning = (0x01<<4)
}<A href="asfont.html#ASFontType">ASFontType</A>;
</PRE></div><br></p></LI></UL>
<A NAME="libAfterImage/ASGlyph"><UL><p class="sect_header"><B>libAfterImage/ASGlyph</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASGlyph"></A><B>ASGlyph</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Stores glyph's image, as well as width, height and other
characteristics of the glyph.
</PRE></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef struct <A href="asfont.html#ASGlyph">ASGlyph</A>
{
CARD8 *pixmap ; /* glyph's RLE encoded pixmap */
short width, height ; /* meaningfull width and height
* of the glyphs pixmap */
short lead, step ; /* distance pen position to glyph
* beginning and to the next glyph */
/* in XRender it should be used as so:
* x = -lead, xOff = step
*/
short ascend, descend ; /* distance of the top of the
* glyph from the baseline */
/* in XRender it should be used as so:
* y = -ascend, yOff = 0
*/
unsigned int font_gid ; /* index of the glyph inside the font( TTF only ) */
long xrender_gid ; /* Used only with XRender - gid of the glyph in GlyphSet */
}<A href="asfont.html#ASGlyph">ASGlyph</A>;
</PRE></div><br></p></LI>
<A NAME="libAfterImage/ASGlyphRange"><UL><p class="sect_header"><B>libAfterImage/ASGlyphRange</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASGlyphRange"></A><B>ASGlyphRange</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Organizes glyphs that belongs to the continuos range of char codes.
<A href="asfont.html#ASGlyphRange">ASGlyphRange</A> structures could be tied together to cover entire
codeset supported by the font.
</PRE></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef struct <A href="asfont.html#ASGlyphRange">ASGlyphRange</A>
{
unsigned long min_char, max_char; /* Code range.
* for some locales that would
* be sufficient to simply <A href="asimagexml.html#set">set</A>
* range of characteres
* supported by font */
<A href="asfont.html#ASGlyph">ASGlyph</A> *glyphs; /* array of glyphs belonging to
* that code range */
struct <A href="asfont.html#ASGlyphRange">ASGlyphRange</A> *below, *above;
}<A href="asfont.html#ASGlyphRange">ASGlyphRange</A>;
</PRE></div><br></p></LI></UL></UL>
<A NAME="libAfterImage/ASFont"><UL><p class="sect_header"><B>libAfterImage/ASFont</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASFont"></A><B>ASFont</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Structure to contain all the font characteristics, as well as
<A href="asimagexml.html#set">set</A> of glyph images. Such structure has to be created/opened prior to
being able to <A href="asfont.html#draw_text()">draw</A> characters with any font.
</PRE></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef struct <A href="asfont.html#ASFont">ASFont</A>
{
unsigned long magic ;
int ref_count ;
struct <A href="asfont.html#ASFontManager">ASFontManager</A> *fontman; /* our owner */
char *name;
<A href="asfont.html#ASFontType">ASFontType</A> type ;
ASFlagType flags ;
<A href="asfont.html#ASGlyphRange">ASGlyphRange</A> *codemap; /* linked <A href="blender.html#list_scanline_merging()">list</A> of glyphsets, each
* representing continuos range of
* available codes - used for ASCII
* codes */
ASHashTable *locale_glyphs; /* hash of locale specific glyphs */
<A href="asfont.html#ASGlyph">ASGlyph</A> default_glyph; /* valid glyph to be drawn when
* code is not valid */
int max_height; /* maximiu height of the character
* glyph */
int max_ascend, /* maximum distance from the baseline
* to the top of the character glyph */
max_descend; /* need both descend and ascend to be
able to dynamically recalculate font
height while adding new characters */
int space_size; /* fixed width <A href="blender.html#value_scanlines()">value</A> to be used when
* rendering spaces and tabs */
int spacing_x, spacing_y;
/* If these are <A href="asimagexml.html#set">set</A> to anything above 0 then all the glyphs has to be
* padded ( <A href="asimagexml.html#if">if</A> its smaller then the cell ) or scaled down
* ( <A href="asimagexml.html#if">if</A> its bigger then the cell )
*/
int cell_width, cell_height ;
#ifdef HAVE_FREETYPE
FT_Face ft_face; /* free type font handle */
#else
CARD32 *<A href="asimagexml.html#pad">pad</A>;
#endif
unsigned long xrender_glyphset ; /* GlyphSet is the actuall datatype,
* but for easier compilation -
* we use generic which is the same */
}<A href="asfont.html#ASFont">ASFont</A>;
</PRE></div><br></p></LI>
<A NAME="libAfterImage/ASFontManager"><UL><p class="sect_header"><B>libAfterImage/ASFontManager</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASFontManager"></A><B>ASFontManager</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Global data identifying connection to external libraries, as well as
fonts location paths.
This structure has to be created/initialized prior to any font being
loaded.
It also holds <A href="blender.html#list_scanline_merging()">list</A> of fonts that are currently <A href="asfont.html#open_freetype_font()">open</A>, allowing for
easy access to fonts.
When ASFontManagaer object is destroyd it automagically closes all
the <A href="asfont.html#open_freetype_font()">open</A> fonts.
</PRE></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef struct <A href="asfont.html#ASFontManager">ASFontManager</A>
{
Display *dpy;
char *font_path ;
ASHashTable *fonts_hash ;
size_t unicode_used;
CARD32 *local_unicode; /* <A href="blender.html#list_scanline_merging()">list</A> of unicodes from current locale
* - we use it to limit number of glyphs
* we load */
Bool ft_ok ;
#ifdef HAVE_FREETYPE
FT_Library ft_library; /* free type library handle */
#else
void *<A href="asimagexml.html#pad">pad</A> ;
#endif
}<A href="asfont.html#ASFontManager">ASFontManager</A>;
</PRE></div><br></p></LI></UL></UL>
<A NAME="libAfterImage/ASText3DType"><UL><p class="sect_header"><B>libAfterImage/ASText3DType</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASText3DType"></A><B>ASText3DType</B><P class="dense">- Available types of 3D <A href="asimagexml.html#text">text</A> to be drawn.
</P></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef enum <A href="asfont.html#ASText3DType">ASText3DType</A>{
AST_Plain =0, /* regular 2D <A href="asimagexml.html#text">text</A> */
AST_Embossed,
AST_Sunken,
AST_ShadeAbove,
AST_ShadeBelow,
AST_EmbossedThick,
AST_SunkenThick,
AST_OutlineAbove,
AST_OutlineBelow,
AST_OutlineFull,
AST_3DTypes
}<A href="asfont.html#ASText3DType">ASText3DType</A>;
</PRE></div><br></p></LI></UL>
<A NAME="libAfterImage/ASTextAttributes"><UL><p class="sect_header"><B>libAfterImage/ASTextAttributes</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="ASTextAttributes"></A><B>ASTextAttributes</B><P class="dense">- Attributes for <A href="asimagexml.html#text">text</A> rendering
</P></LI><LI><p class="refsect_header"><B>SOURCE</B></p><P class="dense"><div class="container"><PRE>
typedef struct <A href="asfont.html#ASTextAttributes">ASTextAttributes</A>
{
#define ASTA_UseTabStops (0x01<<0)
unsigned int version ;
/* structure version, so we can implement future
* extensions without breaking binary apps */
ASFlagType rendition_flags ;
<A href="asfont.html#ASText3DType">ASText3DType</A> type;
ASCharType char_type;
unsigned int tab_size ; /* tab size in chars - defaults to 8 */
unsigned int origin ; /* distance from the left margin
* (in pixels) */
unsigned int *tab_stops ; /* tab stops in pixels where
* left margin is 0 */
unsigned int tab_stops_num ;
<A href="asvisual.html#ARGB32">ARGB32</A> fore_color ; /* used with 3D type of Outlined */
unsigned int width;
#define ASTA_VERSION_1 1
#define ASTA_VERSION_INTERNAL ASTA_VERSION_1
}<A href="asfont.html#ASTextAttributes">ASTextAttributes</A>;
</PRE></div><br></p></LI></UL>
<A NAME="libAfterImage/asfont/create_font_manager()"><UL><p class="sect_header"><B>libAfterImage/asfont/create_font_manager()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="create_font_manager()"></A><B>create_font_manager()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE><A href="asfont.html#ASFontManager">ASFontManager</A> *create_font_manager( Display *dpy,
const char *font_path,
<A href="asfont.html#ASFontManager">ASFontManager</A> *reusable_memory );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>dpy</B></DT><DD class="dense">- pointer to valid and opened Display.
</DD><DT class="dense"><B>font_path</B></DT><DD class="dense">- string, representing colon separated <A href="blender.html#list_scanline_merging()">list</A> of
directories to search for FreeType fonts.
</DD><DT class="dense"><B>reusable_memory</B></DT><DD class="dense">- optional preallocated memory for the ASFontMagaer
object
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>Pointer to Initialized <A href="asfont.html#ASFontManager">ASFontManager</A> object on success.
NULL otherwise.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>create_font_manager() will <A href="asvisual.html#create_asvisual_for_id()">create</A> new <A href="asfont.html#ASFontManager">ASFontManager</A> structure <A href="asimagexml.html#if">if</A>
needed. It wioll then <A href="asimage.html#store_asimage()">store</A> <A href="asimage.html#copy_asimage_channel()">copy</A> of font_path and supplied pointer to
Display in it. At that time Hash table of loaded fonts is initialized,
and <A href="asimagexml.html#if">if</A> needed FreeType library is initialized as well.
<A href="asfont.html#ASFontManager">ASFontManager</A> object returned by this functions has to be <A href="asfont.html#open_freetype_font()">open</A> at all
times untill <A href="asimagexml.html#text">text</A> drawing is no longer needed.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/destroy_font_manager()"><UL><p class="sect_header"><B>libAfterImage/asfont/destroy_font_manager()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="destroy_font_manager()"></A><B>destroy_font_manager()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>void destroy_font_manager( <A href="asfont.html#ASFontManager">ASFontManager</A> *fontman,
Bool reusable );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>fontman</B></DT><DD class="dense">- pointer to valid <A href="asfont.html#ASFontManager">ASFontManager</A> object to be deallocated.
</DD><DT class="dense"><B>reusable</B></DT><DD class="dense">- If True, then memory holding object itself will not be
freed - only resources will be deallocated. That is
useful for structures created on stack.
</DD></DL></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>destroy_font_manager() closes all the fonts <A href="asfont.html#open_freetype_font()">open</A> with this
<A href="asfont.html#ASFontManager">ASFontManager</A>. It will also close connection to FreeType library, and
deallocate all cached data. If reusable is False - then memory used
for object itself will not be freed.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/open_freetype_font()"><UL><p class="sect_header"><B>libAfterImage/asfont/open_freetype_font()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="open_freetype_font()"></A><B>open_freetype_font()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE><A href="asfont.html#ASFont">ASFont</A> *open_freetype_font( <A href="asfont.html#ASFontManager">ASFontManager</A> *fontman,
const char *font_string,
int face_no,
int size, Bool verbose);
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>fontman</B></DT><DD class="dense">- pointer to previously created <A href="asfont.html#ASFontManager">ASFontManager</A>. Needed for
connection to FreeType library, as well as path to
search fonts in.
</DD><DT class="dense"><B>font_string</B></DT><DD class="dense">- filename of the file containing font's data.
</DD><DT class="dense"><B>face_no</B></DT><DD class="dense">- number of face within the font file
</DD><DT class="dense"><B>size</B></DT><DD class="dense">- font size in points. Applicable only to scalable fonts,
such as TrueType.
</DD><DT class="dense"><B>verbose</B></DT><DD class="dense">- <A href="asimagexml.html#if">if</A> True, extensive error messages will be printed <A href="asimagexml.html#if">if</A>
problems encountered.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>pointer to Opened <A href="asfont.html#ASFont">ASFont</A> structure, containing all the glyphs of the
font, as well as other relevant info. On failure returns NULL.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>open_freetype_font() will attempt to find font file in any of the
directories specified in <A href="asfont.html#ASFontManager">ASFontManager</A>'s font_path. If it fails to do
so - then it will check <A href="asimagexml.html#if">if</A> filename has alldigit extentions. It will
then try to interpret that extension as a face number, and try and
find the file with extension stripped off.
If file was found function will atempt to read it using FreeType
library. If requested face is not available in the font - face 0 will
be used.
On success all the font's glyphs will be rendered and cached, and
needed font geometry info collected.
When FreeType Library is not available that function does nothing.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/open_X11_font()"><UL><p class="sect_header"><B>libAfterImage/asfont/open_X11_font()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="open_X11_font()"></A><B>open_X11_font()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE><A href="asfont.html#ASFont">ASFont</A> *open_X11_font( <A href="asfont.html#ASFontManager">ASFontManager</A> *fontman,
const char *font_string);
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>fontman</B></DT><DD class="dense">- pointer to previously created <A href="asfont.html#ASFontManager">ASFontManager</A>. Needed for
connection X Server.
</DD><DT class="dense"><B>font_string</B></DT><DD class="dense">- name of the font as recognized by Xlib.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>pointer to Opened <A href="asfont.html#ASFont">ASFont</A> structure, containing all the glyphs of the
font, as well as other relevant info. On failure returns NULL.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>open_X11_font() attempts to load and <A href="asvisual.html#query_screen_visual_id()">query</A> font using Xlib calls.
On success it goes thgroughthe codemap of the font and renders all
the glyphs available. Glyphs then gets transferred to the client's
memory and encoded using RLE compression. At this time smoothing
filters are applied on glyph pixmaps, <A href="asimagexml.html#if">if</A> its size exceeds threshold.
</PRE></LI><LI><p class="refsect_header"><B>TODO</B></p><PRE>implement proper XFontSet support, when used with I18N enabled.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/get_asfont()"><UL><p class="sect_header"><B>libAfterImage/asfont/get_asfont()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="get_asfont()"></A><B>get_asfont()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE><A href="asfont.html#ASFont">ASFont</A> *get_asfont( <A href="asfont.html#ASFontManager">ASFontManager</A> *fontman,
const char *font_string,
int face_no, int size,
<A href="asfont.html#ASFontType">ASFontType</A> type );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>fontman</B></DT><DD class="dense">- pointer to previously created <A href="asfont.html#ASFontManager">ASFontManager</A>. Needed for
connection to FreeType library, path to search fonts
in, and X Server connection.
</DD><DT class="dense"><B>font_string</B></DT><DD class="dense">- font name or filename of the file containing font's data.
</DD><DT class="dense"><B>face_no</B></DT><DD class="dense">- number of face within the font file
</DD><DT class="dense"><B>size</B></DT><DD class="dense">- font size in points. Applicable only to scalable fonts,
such as TrueType.
</DD><DT class="dense"><B>type</B></DT><DD class="dense">- specifies the type of the font, or GuessWho for
autodetection.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>pointer to Opened <A href="asfont.html#ASFont">ASFont</A> structure, containing all the glyphs of the
font, as well as other relevant info. On failure returns NULL.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>This function provides unified interface to font loading. It performs
search in <A href="asfont.html#ASFontManager">ASFontManager</A>'s <A href="blender.html#list_scanline_merging()">list</A> to see <A href="asimagexml.html#if">if</A> this specific font has been
loaded already, and <A href="asimagexml.html#if">if</A> so - returns pointer to relevant structure.
Otherwise it tryes to load font as FreeType font first, and then
Xlib font, unless exact font type is specifyed.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/release_font()"><UL><p class="sect_header"><B>libAfterImage/asfont/release_font()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="release_font()"></A><B>release_font()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>void release_font( <A href="asfont.html#ASFont">ASFont</A> *font );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>font</B></DT><DD class="dense">- pointer to the valid <A href="asfont.html#ASFont">ASFont</A> structure containing loaded font.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>returns current reference count. -1 means that object has been
destroyed.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>This function will decrement reference count on loaded font and <A href="asimagexml.html#if">if</A>
reference count will be less then 0 ( meaning that release_font() has
been called more times then get_asfont() ) it will close the font,
remove it from <A href="asfont.html#ASFontManager">ASFontManager</A>'s <A href="blender.html#list_scanline_merging()">list</A>, <A href="asvisual.html#destroy_asvisual()">destroy</A> all the glyphs and
generally free everything else used by <A href="asfont.html#ASFont">ASFont</A>.
Otherwise font will remain in memory for faster reuse.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/print_asfont()"><UL><p class="sect_header"><B>libAfterImage/asfont/print_asfont()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="print_asfont()"></A><B>print_asfont()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>void print_asfont( FILE* stream,
<A href="asfont.html#ASFont">ASFont</A>* font);
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>stream</B></DT><DD class="dense">- output file pointer
</DD><DT class="dense"><B>font</B></DT><DD class="dense">- pointer to <A href="asfont.html#ASFont">ASFont</A> structure to <A href="asimage.html#print_asimage_manager()">print</A>.
</DD></DL></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>prints all the geometry information about font.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/print_asglyph()"><UL><p class="sect_header"><B>libAfterImage/asfont/print_asglyph()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="print_asglyph()"></A><B>print_asglyph()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>void print_asglyph( FILE* stream,
<A href="asfont.html#ASFont">ASFont</A>* font, unsigned long c);
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>stream</B></DT><DD class="dense">- output file pointer
</DD><DT class="dense"><B>font</B></DT><DD class="dense">- pointer to <A href="asfont.html#ASFont">ASFont</A> structure to <A href="asimage.html#print_asimage_manager()">print</A>.
</DD><DT class="dense"><B>c</B></DT><DD class="dense">- character code to <A href="asimage.html#print_asimage_manager()">print</A> glyph for
</DD></DL></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>prints out contents of the cached glyph for specifyed character code.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/draw_text()"><UL><p class="sect_header"><B>libAfterImage/asfont/draw_text()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="draw_text()"></A><B>draw_text()</B><P class="dense"></P>
<A NAME="draw_fancy_text()"></A><B>draw_fancy_text()</B><P class="dense"></P>
<A NAME="get_text_size()"></A><B>get_text_size()</B><P class="dense"></P>
<A NAME="get_fancy_text_size();"></A><B>get_fancy_text_size();</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE><A href="asimage.html#ASImage">ASImage</A> *draw_text( const char *<A href="asimagexml.html#text">text</A>,
<A href="asfont.html#ASFont">ASFont</A> *font, <A href="asfont.html#ASText3DType">ASText3DType</A> type,
int compression );
<A href="asimage.html#ASImage">ASImage</A> *draw_fancy_text( const void *<A href="asimagexml.html#text">text</A>,
struct <A href="asfont.html#ASFont">ASFont</A> *font, <A href="asfont.html#ASTextAttributes">ASTextAttributes</A> *attr,
int compression,
int length );
Bool get_text_size( const char *<A href="asimagexml.html#text">text</A>,
<A href="asfont.html#ASFont">ASFont</A> *font, <A href="asfont.html#ASText3DType">ASText3DType</A> type,
unsigned int *width, unsigned int *height );
Bool get_fancy_text_size( const void *<A href="asimagexml.html#text">text</A>,
struct <A href="asfont.html#ASFont">ASFont</A> *font, <A href="asfont.html#ASTextAttributes">ASTextAttributes</A> *attr,
unsigned int *width, unsigned int *height,
int length,
int *x_positions );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>text</B></DT><DD class="dense">- actuall <A href="asimagexml.html#text">text</A> to render
</DD><DT class="dense"><B>font</B></DT><DD class="dense">- pointer to <A href="asfont.html#ASFont">ASFont</A> to render <A href="asimagexml.html#text">text</A> with
</DD><DT class="dense"><B>type</B></DT><DD class="dense">- one of the few available types of 3D <A href="asimagexml.html#text">text</A>.
</DD><DT class="dense"><B>compression</B></DT><DD class="dense">- compression level to attempt on resulting <A href="asimage.html#ASImage">ASImage</A>.
</DD><DT class="dense"><B>width</B></DT><DD class="dense">- pointer to <A href="blender.html#value_scanlines()">value</A> to be <A href="asimagexml.html#set">set</A> to <A href="asimagexml.html#text">text</A> width.
</DD><DT class="dense"><B>height</B></DT><DD class="dense">- pointer to <A href="blender.html#value_scanlines()">value</A> to be <A href="asimagexml.html#set">set</A> to <A href="asimagexml.html#text">text</A> height.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>Pointer to new <A href="asimage.html#ASImage">ASImage</A> containing rendered <A href="asimagexml.html#text">text</A> on success.
NULL on failure.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>draw_text() creates new <A href="asimage.html#ASImage">ASImage</A> of the size big enough to contain
entire <A href="asimagexml.html#text">text</A>. It then renders the <A href="asimagexml.html#text">text</A> using supplied font as an alpha
channel of <A href="asimage.html#ASImage">ASImage</A>.
get_text_size() can be used to determine the size of the <A href="asimagexml.html#text">text</A> about
to be drawn, so that appropriate drawable can be prepared.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/get_asfont_glyph_spacing()"><UL><p class="sect_header"><B>libAfterImage/asfont/get_asfont_glyph_spacing()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="get_asfont_glyph_spacing()"></A><B>get_asfont_glyph_spacing()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>Bool get_asfont_glyph_spacing( <A href="asfont.html#ASFont">ASFont</A>* font, int *x, int *y );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>font</B></DT><DD class="dense">- Loaded <A href="asfont.html#ASFont">ASFont</A> structure.
</DD><DT class="dense"><B>x</B></DT><DD class="dense">- pointer to the variable to receive horizontal spacing <A href="blender.html#value_scanlines()">value</A>.
</DD><DT class="dense"><B>y</B></DT><DD class="dense">- pointer to the variable to receive vertical spacing <A href="blender.html#value_scanlines()">value</A>.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>True <A href="asimagexml.html#if">if</A> meaningfull information has been returned.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Returns inter-glyph spacing of specified font.
</PRE></LI></UL>
<A NAME="libAfterImage/asfont/set_asfont_glyph_spacing()"><UL><p class="sect_header"><B>libAfterImage/asfont/set_asfont_glyph_spacing()</B></p></A><LI><p class="refsect_header"><B>NAME</B></p>
<A NAME="set_asfont_glyph_spacing()"></A><B>set_asfont_glyph_spacing()</B><P class="dense"></P></LI><LI><p class="refsect_header"><B>SYNOPSIS</B></p><PRE>Bool set_asfont_glyph_spacing( <A href="asfont.html#ASFont">ASFont</A>* font, int x, int y );
</PRE></LI><LI><p class="refsect_header"><B>INPUTS</B></p><DL class="dense"><DT class="dense"><B>font</B></DT><DD class="dense">- Loaded <A href="asfont.html#ASFont">ASFont</A> structure.
</DD><DT class="dense"><B>x</B></DT><DD class="dense">- new horizontal spacing <A href="blender.html#value_scanlines()">value</A>.
</DD><DT class="dense"><B>y</B></DT><DD class="dense">- new vertical spacing <A href="blender.html#value_scanlines()">value</A>.
</DD></DL></LI><LI><p class="refsect_header"><B>RETURN VALUE</B></p><PRE>TRue on success.
</PRE></LI><LI><p class="refsect_header"><B>DESCRIPTION</B></p><PRE>Changes inter-glyph spacing of the specified font.
</PRE></LI></UL>
<p><A href="preface.html">Preface</A> <A href="visualselect.html">Introduction</A> <A href="index.html">Topic index</A> <A href="Glossary.html">Glossary</A> <A href="#page_top">Back to Top</A>
<hr>
<p><FONT face="Verdana, Arial, Helvetica, sans-serif" size="-2">AfterStep version 2.2.12</a></FONT>
</body>
</html>
|