Commit f2b7ba53 authored by darin's avatar darin
Browse files

Reviewed by Steve.

        - clean up options for font code path

        * platform/Font.h:
        * platform/Font.cpp:
        (WebCore::Font::setCodePath): Added. Replaces boolean version.
        (WebCore::Font::canUseGlyphCache): Update to handle "never use complex" case too.

        * platform/mac/WebCoreTextRenderer.mm:
        (WebCoreSetAlwaysUseATSU): Change to call setCodePath.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent caf3550b
2006-09-26 Darin Adler <darin@apple.com>
Reviewed by Steve.
- clean up options for font code path
* platform/Font.h:
* platform/Font.cpp:
(WebCore::Font::setCodePath): Added. Replaces boolean version.
(WebCore::Font::canUseGlyphCache): Update to handle "never use complex" case too.
* platform/mac/WebCoreTextRenderer.mm:
(WebCoreSetAlwaysUseATSU): Change to call setCodePath.
2006-09-26 John Sullivan <sullivan@apple.com>
 
Reviewed by Darin
......@@ -52,6 +52,8 @@ const uint8_t Font::gRoundingHackCharacterTable[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
Font::CodePath Font::codePath = Auto;
struct WidthIterator {
WidthIterator(const Font* font, const TextRun& run, const TextStyle& style, const FontData* substituteFontData = 0);
......@@ -410,17 +412,21 @@ bool Font::isFixedPitch() const
return m_fontList->isFixedPitch(this);
}
// FIXME: These methods will eventually be cross-platform, but to keep Windows compiling we'll make this Apple-only for now.
bool Font::gAlwaysUseComplexPath = false;
void Font::setAlwaysUseComplexPath(bool alwaysUse)
void Font::setCodePath(CodePath p)
{
gAlwaysUseComplexPath = alwaysUse;
codePath = p;
}
bool Font::canUseGlyphCache(const TextRun& run) const
{
if (gAlwaysUseComplexPath)
return false;
switch (codePath) {
case Auto:
break;
case Simple:
return true;
case Complex:
return false;
}
// Start from 0 since drawing and highlighting also measure the characters before run->from
for (int i = 0; i < run.to(); i++) {
......
......@@ -166,10 +166,11 @@ private:
friend struct WidthIterator;
// Useful for debugging the complex font rendering code path.
// Useful for debugging the different font rendering code paths.
public:
static void setAlwaysUseComplexPath(bool);
static bool gAlwaysUseComplexPath;
enum CodePath { Auto, Simple, Complex };
static void setCodePath(CodePath);
static CodePath codePath;
static const uint8_t gRoundingHackCharacterTable[256];
static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; }
......
......@@ -82,7 +82,7 @@ bool WebCoreShouldUseFontSmoothing()
void WebCoreSetAlwaysUseATSU(bool useATSU)
{
Font::setAlwaysUseComplexPath(useATSU);
Font::setCodePath(useATSU ? Font::Complex : Font::Auto);
}
NSFont* WebCoreFindFont(NSString* familyName, NSFontTraitMask traits, int size)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment