如何取ttf字模?

garfield9527 2004-11-06 12:37:05
如何取ttf字模?
...全文
335 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ygd 2004-11-12
  • 打赏
  • 举报
回复
getGlyphOutline()得到矢量字体的控制点
点阵字 ,请找库点阵字库
broadoceans 2004-11-11
  • 打赏
  • 举报
回复
24*24

m_lf.lfHeight = 16;
if(m_Str[0] & 0x80) //汉字
{
m_lf.lfWidth = 8;
}
else
{
m_lf.lfWidth = 16;
}

改为
m_lf.lfHeight = 24;
if(m_Str[0] & 0x80) //汉字
{
m_lf.lfWidth = 12;
}
else
{
m_lf.lfWidth = 24;
}
broadoceans 2004-11-11
  • 打赏
  • 举报
回复
以下是16*16的程序


const char* m_Str = "A";

LOGFONT m_lf;
memset(&m_lf, 0, sizeof(LOGFONT));
m_lf.lfHeight = 16;
if(m_Str[0] & 0x80) //汉字
{
m_lf.lfWidth = 8;
}
else
{
m_lf.lfWidth = 16;
}


m_lf.lfCharSet = GB2312_CHARSET;

strcpy(m_lf.lfFaceName, "Arial");

CDC dc;
dc.CreateDC("DISPLAY", NULL, NULL, NULL);
dc.SelectStockObject(SYSTEM_FIXED_FONT);


CFont font;
int i=0,j;
CFile file;
file.Open("abc.txt",CFile::modeWrite |CFile::modeCreate);
font.CreateFontIndirect(&m_lf);
CFont *pFont=dc.SelectObject(&font);
int mpMode = dc.GetMapMode();
dc.TextOut(0,0,m_Str);

CSize cs = dc.GetTextExtent(m_Str);

for(i=0;i<abs(m_lf.lfHeight);i++)
{
for(j=0;j<abs(cs.cx);j++)
{
if(dc.GetPixel(CPoint(j,i))!=RGB(0,0,0))
{
file.Write("0",1);
}else
{
file.Write("1",1);
}
}
file.Write("\r\n",2);
}
file.Close();
dc.SelectObject(pFont);
DeleteDC(dc);
eastred 2004-11-11
  • 打赏
  • 举报
回复
用CreateFont创建字体,把字TextOut再用GetPixel()取点存入数组。
garfield9527 2004-11-08
  • 打赏
  • 举报
回复
我想从windows的ttf字体中提取为16*16或者24*24点阵字体存储在一个数组中
getGlyphOutline()函数是可以得到文字的轮廓,
但是如果取得如上我所说的点阵字体数组呢?
xili 2004-11-08
  • 打赏
  • 举报
回复
也可以,认真看msdn的说明
xili 2004-11-07
  • 打赏
  • 举报
回复
getGlyphOutline
syy64 2004-11-06
  • 打赏
  • 举报
回复
关注。
FengYuanMSFT 2004-11-06
  • 打赏
  • 举报
回复
More details? What do you want?

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧