routiens for mroe text info.....

SVN revision: 3454
This commit is contained in:
Carsten Haitzler 2000-09-13 17:11:53 +00:00
parent 361f941365
commit 54af8d51ff
4 changed files with 98 additions and 0 deletions

View File

@ -1436,6 +1436,66 @@ __evas_gl_text_font_get_descent(Evas_GL_Font *fn)
return fn->descent;
}
int
__evas_gl_text_font_get_max_ascent(Evas_GL_Font *fn)
{
return fn->max_ascent / 64;
}
int
__evas_gl_text_font_get_max_descent(Evas_GL_Font *fn)
{
return fn->max_descent / 64;
}
void
__evas_gl_text_font_get_advances(Evas_GL_Font *fn, char *text,
int *advance_horiz,
int *advance_vert)
{
int i, ascent, descent, pw, ph;
TT_Glyph_Metrics gmetrics;
ascent = fn->ascent;
descent = fn->descent;
pw = 0;
ph = ascent + descent;
for (i = 0; text[i]; i++)
{
unsigned char j;
j = text[i];
if (!TT_VALID(fn->glyphs[j]))
continue;
TT_Get_Glyph_Metrics(fn->glyphs[j], &gmetrics);
if (i == 0)
pw += ((-gmetrics.bearingX) / 64);
pw += gmetrics.advance / 64;
}
*advance_horiz = pw;
*advance_vert = ph;
}
int
__evas_gl_text_font_get_first_inset(Evas_GL_Font *fn, char *text)
{
int i;
TT_Glyph_Metrics gmetrics;
for (i = 0; text[i]; i++)
{
unsigned char j;
j = text[i];
if (!TT_VALID(fn->glyphs[j]))
continue;
TT_Get_Glyph_Metrics(fn->glyphs[j], &gmetrics);
return ((-gmetrics.bearingX) / 64);
}
return 0;
}
void
__evas_gl_text_font_add_path(char *path)
{

View File

@ -160,6 +160,10 @@ Evas_GL_Font *__evas_gl_text_font_new(Display *disp, char *font, int size);
void __evas_gl_text_font_free(Evas_GL_Font *fn);
int __evas_gl_text_font_get_ascent(Evas_GL_Font *fn);
int __evas_gl_text_font_get_descent(Evas_GL_Font *fn);
int __evas_gl_text_font_get_max_ascent(Evas_GL_Font *fn);
int __evas_gl_text_font_get_max_descent(Evas_GL_Font *fn);
void __evas_gl_text_font_get_advances(Evas_GL_Font *fn, char *text, int *advance_horiz, int *advance_vert);
int __evas_gl_text_font_get_first_inset(Evas_GL_Font *fn, char *text);
void __evas_gl_text_font_add_path(char *path);
void __evas_gl_text_font_del_path(char *path);
char **__evas_gl_text_font_list_paths(int *count);

View File

@ -200,6 +200,36 @@ __evas_imlib_text_font_get_descent(Evas_Imlib_Font *fn)
return imlib_get_font_descent();
}
int
__evas_imlib_text_font_get_max_ascent(Evas_Imlib_Font *fn)
{
imlib_context_set_font((Imlib_Font)fn);
return imlib_get_maximum_font_ascent();
}
int
__evas_imlib_text_font_get_max_descent(Evas_Imlib_Font *fn)
{
imlib_context_set_font((Imlib_Font)fn);
return imlib_get_maximum_font_descent();
}
void
__evas_imlib_text_font_get_advances(Evas_Imlib_Font *fn, char *text,
int *advance_horiz,
int *advance_vert)
{
imlib_context_set_font((Imlib_Font)fn);
imlib_get_text_advance(text, advance_horiz, advance_vert);
}
int
__evas_imlib_text_font_get_first_inset(Evas_Imlib_Font *fn, char *text)
{
imlib_context_set_font((Imlib_Font)fn);
return imlib_get_text_inset(text);
}
void
__evas_imlib_text_font_add_path(char *path)
{

View File

@ -62,6 +62,10 @@ Evas_Imlib_Font *__evas_imlib_text_font_new(Display *disp, char *font, int size
void __evas_imlib_text_font_free(Evas_Imlib_Font *fn);
int __evas_imlib_text_font_get_ascent(Evas_Imlib_Font *fn);
int __evas_imlib_text_font_get_descent(Evas_Imlib_Font *fn);
int __evas_imlib_text_font_get_max_ascent(Evas_Imlib_Font *fn);
int __evas_imlib_text_font_get_max_descent(Evas_Imlib_Font *fn);
void __evas_imlib_text_font_get_advances(Evas_Imlib_Font *fn, char *text, int *advance_horiz, int *advance_vert);
int __evas_imlib_text_font_get_first_inset(Evas_Imlib_Font *fn, char *text);
void __evas_imlib_text_font_add_path(char *path);
void __evas_imlib_text_font_del_path(char *path);
char **__evas_imlib_text_font_list_paths(int *count);