硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2136|回复: 4
收起左侧

[TouchGFX] 移植freetype,使用文泉驿开源字库,返回给touchgfx的参数有误,拜托大侠指教

[复制链接]

1

主题

1

回帖

4

积分

新手上路

积分
4
发表于 2019-6-25 12:07:26 | 显示全部楼层 |阅读模式
const touchgfx::GlyphNode* touchgfx::hmfont::getGlyph(Unicode::UnicodeChar unicode,
        const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
{
gn->dataOffset                         = 0;//glyph_index;
gn->unicode                         = unicode;
gn->_width                         = (uint8_t)face->glyph->bitmap.width;
gn->_height                         = (uint8_t)face->glyph->bitmap.rows;
gn->_top                                 = (uint8_t)face->glyph->bitmap_top;
gn->left                                 = (int8_t)face->glyph->bitmap_left;
gn->_advance                         = (uint8_t)(face->glyph->advance.x>>6);
gn->kerningTablePos                 = 255;
gn->kerningTableSize         = 0;
gn->flags = 1;
pixelData = face->glyph->bitmap.buffer;
bitsPerPixel = 8;
ft_fontHeight = gn->_height;
}
使用win10下的一个ttf字库返回都正常,但是使用文泉驿微米黑ttc转ttf字库,参数一直无法适配,求大侠指教。

uint32_t             dataOffset;       ///< The index to the data of this glyph
    Unicode::UnicodeChar unicode;          ///< The unicode of this glyph.
    uint8_t              _width;           ///< Width of the actual glyph data
    uint8_t              _height;          ///< Height of the actual glyph data
    uint8_t              _top;             ///< Vertical offset from baseline of the glyph
    int8_t               left;             ///< Horizontal offset from the left of the glyph
    uint8_t              _advance;         ///< Width of the glyph (including space to the left and right)
    uint8_t              kerningTablePos;  ///< Where are the kerning information for this glyph stored in the kerning table
    uint8_t              kerningTableSize; ///< How many entries are there in the kerning table (following kerningTablePos) for this glyph
    uint8_t              flags;            ///< Additional glyph flags (font encoding and extra precision for width/height/top/advance)

回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107122
QQ
发表于 2019-6-25 12:10:27 | 显示全部楼层
楼主可以把emWin的那个矢量字库包导出来使用,那个包是有源码的,可以使用,也是用freetype
emWin配套的矢量字体库已经升级到5.36了
http://www.armbbs.cn/forum.php?m ... 1555&fromuid=58
(出处: 安富莱电子论坛)


回复

使用道具 举报

1

主题

1

回帖

4

积分

新手上路

积分
4
 楼主| 发表于 2019-6-25 12:59:30 | 显示全部楼层
eric2013 发表于 2019-6-25 12:10
楼主可以把emWin的那个矢量字库包导出来使用,那个包是有源码的,可以使用,也是用freetype
emWin配套的矢 ...

我就是用的emwin的源文件
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107122
QQ
发表于 2019-6-25 14:00:45 | 显示全部楼层
白芨 发表于 2019-6-25 12:59
我就是用的emwin的源文件

这样的话,就略麻烦了。
回复

使用道具 举报

39

主题

929

回帖

1051

积分

至尊会员

积分
1051
发表于 2019-6-25 14:56:36 | 显示全部楼层
用win10下的一些字体正常,用文泉驿ttc转ttf的不正常?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-19 09:00 , Processed in 0.156814 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表