need to convert from utf8 to utf-32bit

master
steffen 13 years ago
parent a8bfba1032
commit 698cf67bd4

@ -58,6 +58,7 @@ struct font* font_load(char *fname) {
FT_Set_Pixel_Sizes(f->face, 0, 16); FT_Set_Pixel_Sizes(f->face, 0, 16);
d_printf ("font loaded (size:%d).", f->buffersize); d_printf ("font loaded (size:%d).", f->buffersize);
FT_Select_Charmap(f->face, FT_ENCODING_UNICODE);
return f; return f;
} }

@ -0,0 +1,23 @@
/* $Id: utf8.c,v 1.1 2013/06/05 22:16:06 steffen Exp $ */
/* utf8.c
* Copyright (C) Steffen Pohle 2013 <steffen@gulpe.de>
*
* spOSMroute is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* spOSMroute is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stings.h>
#include "utf8.h"

@ -0,0 +1,25 @@
/* $Id: utf8.h,v 1.1 2013/06/05 22:16:06 steffen Exp $ */
/* utf8.h
* Copyright (C) Steffen Pohle 2013 <steffen@gulpe.de>
*
* spOSMroute is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* spOSMroute is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _UTF8_H_
#define _UTF8_H_
#endif

@ -29,7 +29,7 @@ int font_init () {
struct font* font_load(char *name) { struct font* font_load(char *name) {
int fd; int fd, i;
struct font *f = NULL; struct font *f = NULL;
char fname[LEN_FILENAME]; char fname[LEN_FILENAME];
struct stat st_buf; struct stat st_buf;
@ -58,6 +58,16 @@ struct font* font_load(char *name) {
FT_Set_Pixel_Sizes(f->face, 0, 12); FT_Set_Pixel_Sizes(f->face, 0, 12);
d_printf ("font loaded (size:%d).", f->buffersize); d_printf ("font loaded (size:%d).", f->buffersize);
d_printf ("charmap: %d == %d (unicode)", f->face->charmap->encoding, FT_ENCODING_UNICODE);
if (FT_Select_Charmap(f->face, FT_ENCODING_UNICODE))
d_printf ("FT_Select_Charmap: error");
for (i = 0; i < f->face->num_charmaps; i++)
d_printf (" %d : encoding: %d", i, f->face->charmap[i].encoding);
d_printf ("charmap: %d == %d (unicode)", f->face->charmap->encoding, FT_ENCODING_UNICODE);
return f; return f;
} }
@ -76,6 +86,8 @@ void font_draw (struct font *f, char *text, float x, float y, float sx, float sy
0, 0}; 0, 0};
FT_GlyphSlot g = f->face->glyph; FT_GlyphSlot g = f->face->glyph;
if (strncmp ("Than", text, 4) == 0) d_printf ("'%s' drawing", text);
/* Create a texture that will be used to hold one "glyph" */ /* Create a texture that will be used to hold one "glyph" */
GLuint tex; GLuint tex;
glGenTextures(1, &tex); glGenTextures(1, &tex);

Loading…
Cancel
Save