- aGc.Device()->GetNearestFontInTwips(font,fontSpec);
- aGc.SetPenColor(KRgbBlack);
- aGc.SetPenStyle(CGraphicsContext::ESolidPen);
- aGc.UseFont(font);
- aGc.DrawText(text,TPoint(0,font->HeightInPixels()));
- aGc.DiscardFont();
- aGc.Device()->ReleaseFont(font);
上面的代码里面如果没有调用最后一句ReleaseFont就会产生该错误CTypefaceStore -14
GetNearestFontInTwips和ReleaseFont必须成对出现,
使用CGraphicsDevice及其集成类的GetNearestFontInTwips 等方法创建自定义字体的时候,
使用完字体要调用一下ReleaseFont 释放 该字体。
类似函数还有GetNearestFontToDesignHeightInTwips(), GetNearestFontToMaxHeightInTwips(),
如果是CFbsDevice等,还有这些函数
GetFontById()
GetNearestFontToMaxHeightInPixels()
GetNearestFontInPixels()
GetNearestFontToDesignHeightInPixels()
GetNearestFontToMaxHeightInPixels()也需要relesefont