【问题标题】:SDL TTF not showing ellipsis on some fontsSDL TTF 在某些字体上未显示省略号
【发布时间】:2012-11-01 10:35:51
【问题描述】:

在某些字体上,我无法让 SDL_TTF 渲染某些字形(例如……),即使我知道它们存在(如果我在 gedit 中使用相同的字体,它也可以正常工作)。

生成文件:

test: test.c
    gcc -o test -ansi -pedantic -Wall test.c `sdl-config --cflags --libs` -lSDL_ttf

示例(test.c):

#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>

int main(int argc, char *argv[]) {
    SDL_Init(SDL_INIT_EVERYTHING);
    TTF_Init();

    {
        SDL_Event ev;
        SDL_Color color = {255,255,255};
        SDL_Surface *win = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
        TTF_Font *drawfont = TTF_OpenFont("./ProggySquareSZ.ttf", 22);
        SDL_Surface *text_surface = TTF_RenderUTF8_Solid(drawfont,"…",color);
        SDL_Rect r = {10, 10, 0, 0};
        SDL_BlitSurface(text_surface,NULL,win,&r);

        SDL_Flip(win);
        while(SDL_WaitEvent(&ev)) {
            if(ev.type == SDL_QUIT) break;
        }
    }

    return 0;
}

【问题讨论】:

    标签: fonts sdl sdl-ttf


    【解决方案1】:

    此字体没有

    Name: ProggySquareTTSZ
    Supported Unicode Blocks
        0x0000 - 0x00FF   ANSI
    

    水平省略号有U+2026码,大于0x00FF(255)。

    您可能会在 gedit 中看到 ,因为在某些操作系统和软件中,如果在 字体,它被替换为更相似的字体,安装在 操作系统,然后显示。

    【讨论】:

    • 听起来可能。您从哪里获得包含在内的信息?我希望能够分析其他字体,看看是否包含我需要的字形。
    • 我使用名为 wlxFont 的旧 Total Commander 插件。你可以在这里找到它users.telenet.be/liontech/Downloads.htm。我认为还有其他程序可以显示有关字体的信息,只需 google 即可。
    • Аlso 在 sdl_ttf 中有一个 TTF_GlyphIsProvided 函数,您可以使用它查看字体中是否有字符。
    猜你喜欢
    • 1970-01-01
    • 2011-03-15
    • 1970-01-01
    • 2018-02-03
    • 1970-01-01
    • 2013-09-15
    • 1970-01-01
    • 2014-11-21
    • 1970-01-01
    相关资源
    最近更新 更多