Didn't I have a bad feeling because of code duplication?
* fixed a bug in the font cache, the signature was generated in one way (rendering type) while the initialization of the font engine could use another way * should fix non-antialiased straight text * weird non-transformed text in FontDemo * generally not using vector glyphs when it was supposed to use them (rotated or sheared text, or non-antialiased text) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21866 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a2057fac93
commit
e83f8dc9a0
@ -116,9 +116,7 @@ FontCacheEntry::~FontCacheEntry()
|
||||
bool
|
||||
FontCacheEntry::Init(const ServerFont& font)
|
||||
{
|
||||
glyph_rendering renderingType = glyph_ren_native_gray8;
|
||||
if (font.Rotation() != 0.0 || font.Shear() != 90.0)
|
||||
renderingType = glyph_ren_outline;
|
||||
glyph_rendering renderingType = _RenderTypeFor(font);
|
||||
|
||||
// TODO: encoding from font
|
||||
FT_Encoding charMap = FT_ENCODING_NONE;
|
||||
@ -211,18 +209,13 @@ FontCacheEntry::GetKerning(uint16 glyphCode1, uint16 glyphCode2,
|
||||
/*static*/ void
|
||||
FontCacheEntry::GenerateSignature(char* signature, const ServerFont& font)
|
||||
{
|
||||
glyph_rendering renderingType = glyph_ren_native_gray8;
|
||||
if (font.Rotation() != 0.0 || font.Shear() != 90.0
|
||||
|| font.Flags() & B_DISABLE_ANTIALIASING
|
||||
|| font.Size() > 30) {
|
||||
renderingType = glyph_ren_outline;
|
||||
}
|
||||
glyph_rendering renderingType = _RenderTypeFor(font);
|
||||
|
||||
// TODO: read more of these from the font
|
||||
FT_Encoding charMap = FT_ENCODING_NONE;
|
||||
bool hinting = true; // TODO: font.Hinting();
|
||||
|
||||
sprintf(signature, "%ld%u%d%d%.1f%d",
|
||||
sprintf(signature, "%ld,%u,%d,%d,%.1f,%d",
|
||||
font.GetFamilyAndStyle(), charMap,
|
||||
font.Face(), int(renderingType), font.Size(), hinting);
|
||||
}
|
||||
@ -242,3 +235,15 @@ FontCacheEntry::UpdateUsage()
|
||||
fUseCounter++;
|
||||
}
|
||||
|
||||
// _RenderTypeFor
|
||||
/*static*/ glyph_rendering
|
||||
FontCacheEntry::_RenderTypeFor(const ServerFont& font)
|
||||
{
|
||||
glyph_rendering renderingType = glyph_ren_native_gray8;
|
||||
if (font.Rotation() != 0.0 || font.Shear() != 90.0
|
||||
|| font.Flags() & B_DISABLE_ANTIALIASING
|
||||
|| font.Size() > 30) {
|
||||
renderingType = glyph_ren_outline;
|
||||
}
|
||||
return renderingType;
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ class FontCacheEntry : public MultiLocker, public Referenceable {
|
||||
FontCacheEntry(const FontCacheEntry&);
|
||||
const FontCacheEntry& operator=(const FontCacheEntry&);
|
||||
|
||||
static glyph_rendering _RenderTypeFor(const ServerFont& font);
|
||||
|
||||
class GlyphCachePool;
|
||||
|
||||
GlyphCachePool* fGlyphCache;
|
||||
|
Loading…
Reference in New Issue
Block a user