summaryrefslogtreecommitdiffstats
path: root/libmenu/menu.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-11-18 00:09:37 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-11-18 00:09:37 +0000
commitdc7759b0a8eb0cc1051d74176f1efba42d8a2079 (patch)
treeaffaddfae8197dc3b80edca9cbc913fd27fb735c /libmenu/menu.c
parentfbed04310ed22661d3a979325a063ff2c07e874d (diff)
downloadmpv-dc7759b0a8eb0cc1051d74176f1efba42d8a2079.tar.bz2
mpv-dc7759b0a8eb0cc1051d74176f1efba42d8a2079.tar.xz
Fix freetype. Freetype is highly recommended for a nice output ;)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8225 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmenu/menu.c')
-rw-r--r--libmenu/menu.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c
index 89842f5c6e..f7eadcf38a 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -262,6 +262,20 @@ inline static draw_alpha_f get_draw_alpha(uint32_t fmt) {
return NULL;
}
+// return the real height of a char:
+static inline int get_height(int c,int h){
+ int font;
+ if ((font=vo_font->font[c])>=0)
+ if(h<vo_font->pic_a[font]->h) h=vo_font->pic_a[font]->h;
+ return h;
+}
+
+#ifdef HAVE_FREETYPE
+#define render_txt(t) { char* p = t; while(*p) render_one_glyph(vo_font,*p++); }
+#else
+#define render_txt(t)
+#endif
+
void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) {
draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
@@ -272,6 +286,8 @@ void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) {
return;
}
+ render_txt(txt);
+
while (*txt) {
unsigned char c=*txt++;
if ((font=vo_font->font[c])>=0 && (x + vo_font->width[c] <= mpi->w) && (y + vo_font->pic_a[font]->h <= mpi->h))
@@ -301,6 +317,8 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt,
return;
}
+ render_txt(txt);
+
if(x > mpi->w || y > mpi->h)
return;
@@ -456,6 +474,7 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt,
int menu_text_length(char* txt) {
int l = 0;
+ render_txt(txt);
while (*txt) {
unsigned char c=*txt++;
l += vo_font->width[c]+vo_font->charspace;
@@ -466,7 +485,8 @@ int menu_text_length(char* txt) {
void menu_text_size(char* txt,int max_width, int vspace, int warp, int* _w, int* _h) {
int l = 1, i = 0;
int w = 0;
-
+
+ render_txt(txt);
while (*txt) {
unsigned char c=*txt++;
if(c == '\n' || (warp && i + vo_font->width[c] >= max_width)) {
@@ -486,6 +506,7 @@ void menu_text_size(char* txt,int max_width, int vspace, int warp, int* _w, int*
int menu_text_num_lines(char* txt, int max_width) {
int l = 1, i = 0;
+ render_txt(txt);
while (*txt) {
unsigned char c=*txt++;
if(c == '\n' || i + vo_font->width[c] > max_width) {
@@ -500,6 +521,7 @@ int menu_text_num_lines(char* txt, int max_width) {
char* menu_text_get_next_line(char* txt, int max_width) {
int i = 0;
+ render_txt(txt);
while (*txt) {
unsigned char c=*txt;
if(c == '\n') {