mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
correctly render utf
Was using the wrong API. Also upgraded font to DejaVu Sans
This commit is contained in:
parent
f0d8a71deb
commit
430b6894f0
3 changed files with 3 additions and 3 deletions
BIN
xwords4/wasm/assets_dir/DejaVuSansCondensed.ttf
Normal file
BIN
xwords4/wasm/assets_dir/DejaVuSansCondensed.ttf
Normal file
Binary file not shown.
Binary file not shown.
|
@ -100,7 +100,7 @@ fontFor( WasmDrawCtx* wdctx, int height )
|
|||
wdctx->fonts = rec;
|
||||
|
||||
rec->size = height;
|
||||
rec->font = TTF_OpenFont( "assets_dir/FreeSans.ttf", height );
|
||||
rec->font = TTF_OpenFont( "assets_dir/DejaVuSansCondensed.ttf", height );
|
||||
result = rec->font;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ measureText( WasmDrawCtx* wdctx, const XP_UCHAR* text, int fontHeight,
|
|||
{
|
||||
SDL_Color black = { 0, 0, 0, 255 };
|
||||
TTF_Font* font = fontFor( wdctx, fontHeight );
|
||||
SDL_Surface* surface = TTF_RenderText_Blended( font, text, black );
|
||||
SDL_Surface* surface = TTF_RenderUTF8_Blended( font, text, black );
|
||||
SDL_Texture* texture = SDL_CreateTextureFromSurface( wdctx->renderer,
|
||||
surface );
|
||||
SDL_QueryTexture( texture, NULL, NULL, widthP, heightP );
|
||||
|
@ -201,7 +201,7 @@ textInRect( WasmDrawCtx* wdctx, const XP_UCHAR* text, const XP_Rect* rect,
|
|||
if ( NULL == color ) {
|
||||
color = &black;
|
||||
}
|
||||
SDL_Surface* surface = TTF_RenderText_Blended( font, text, *color );
|
||||
SDL_Surface* surface = TTF_RenderUTF8_Blended( font, text, *color );
|
||||
SDL_Texture* texture = SDL_CreateTextureFromSurface( wdctx->renderer, surface );
|
||||
SDL_FreeSurface( surface );
|
||||
|
||||
|
|
Loading…
Reference in a new issue