Commit 909b8eb8 authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Dave Hyatt.

        - fix <rdar://problem/5873639> REGRESSION (r31620): css2.1/t1506-c525-font-wt-00-b fails on Windows

        - fix https://bugs.webkit.org/show_bug.cgi?id=18863
          <rdar://problem/5908890> weight mappings with @font-face aren't consistent

        Tests: fast/css/font-face-locally-installed.html
               fast/css/font-face-multiple-faces.html

        * WebCore.vcproj/WebCore.vcproj: Added FontTraitsMask.h.

        * WebCore.xcodeproj/project.pbxproj: Ditto.

        * css/CSSFontFace.h:
        Made CSSFontFace store descriptors from the @font-face rule, as follows:
        (WebCore::CSSFontFace::create): Added a FontTraitsMask argument.
        (WebCore::CSSFontFace::traitsMask): Added this accessor.
        (WebCore::CSSFontFace::addRange): Added.
        (WebCore::CSSFontFace::ranges): Added.
        (WebCore::CSSFontFace::UnicodeRange::UnicodeRange):
        (WebCore::CSSFontFace::UnicodeRange::from):
        (WebCore::CSSFontFace::UnicodeRange::to):
        (WebCore::CSSFontFace::CSSFontFace): Added a FontTraitsMask and a vector
        of UnicodeRanges as member variables.

        * css/CSSFontFaceSource.cpp:
        Changed the hash key from the font size alone to the font size and
        the synthetic style bits, needed if the same source supplies different
        synthesized versions.
        (WebCore::CSSFontFaceSource::pruneTable):
        (WebCore::CSSFontFaceSource::getFontData):

        * css/CSSFontFaceSource.h:

        * css/CSSFontSelector.cpp:
        (WebCore::CSSFontSelector::~CSSFontSelector): Added code to delete
        the contents of the font face, locally-installed font face and segmented
        font tables.
        (WebCore::CSSFontSelector::addFontFaceRule): Changed this function to
        not create segmented font faces, but instead just collect font faces
        and annotate them with descriptors (traits and unicode ranges).
        (WebCore::compareFontFaces): Added. Used in getFontData() to sort the
        font faces by proximity to the desired traits.
        (WebCore::CSSFontSelector::getFontData): Changed to create the segmented
        font face here and cache it.

        * css/CSSFontSelector.h:

        * css/CSSSegmentedFontFace.cpp:
        Changed to keep a vector of font faces instead of font face ranges, as
        font faces now know their Unicode ranges.
        (WebCore::CSSSegmentedFontFace::~CSSSegmentedFontFace):
        (WebCore::CSSSegmentedFontFace::isLoaded):
        (WebCore::CSSSegmentedFontFace::isValid):
        (WebCore::CSSSegmentedFontFace::appendFontFace):
        (WebCore::CSSSegmentedFontFace::getFontData): Removed the synthetic
        traits parameters, and instead changed to set them on each FontData
        separately based on the difference between the desired traits and
        the font face's traits.

        * css/CSSSegmentedFontFace.h:

        * platform/graphics/FontCache.h:
        Removed fontExists() and added getTraitsInFamily().

        * platform/graphics/FontDescription.cpp:
        (WebCore::FontDescription::traitsMask): Added.

        * platform/graphics/FontDescription.h:

        * platform/graphics/FontTraitsMask.h: Added.

        * platform/graphics/GlyphPageTreeNode.cpp:
        (WebCore::GlyphPageTreeNode::initializePage): Changed to fill in with
        glyphs from all fonts in the segmented font, using each font in turn to
        fill in characters not covered by earlier fonts.

        * platform/graphics/gtk/FontCacheGtk.cpp:
        (WebCore::FontCache::getTraitsInFamily): Added a stub.

        * platform/graphics/mac/FontCacheMac.mm:
        (WebCore::FontCache::getTraitsInFamily): Added.

        * platform/graphics/qt/FontCacheQt.cpp:
        (WebCore::FontCache::getTraitsInFamily): Added a stub.

        * platform/graphics/win/FontCacheWin.cpp:
        (WebCore::TraitsInFamilyProcData::TraitsInFamilyProcData): Added.
        (WebCore::traitsInFamilyEnumProc): Added.
        (WebCore::FontCache::getTraitsInFamily): Added.

        * platform/graphics/wx/FontCacheWx.cpp:
        (WebCore::FontCache::getTraitsInFamily): Added a stub.

        * platform/mac/WebFontCache.h:
        * platform/mac/WebFontCache.mm:
        (toTraitsMask): Added.
        (+[WebFontCache getTraits:inFamily:]): Added.

LayoutTests:

        Reviewed by Dave Hyatt.

        - tests for https://bugs.webkit.org/show_bug.cgi?id=18863
          <rdar://problem/5908890> weight mappings with @font-face aren't consistent

        * fast/css/font-face-locally-installed.html: Added.
        * fast/css/font-face-multiple-faces.html: Added.
        * platform/mac/fast/css/font-face-locally-installed-expected.checksum: Added.
        * platform/mac/fast/css/font-face-locally-installed-expected.png: Added.
        * platform/mac/fast/css/font-face-locally-installed-expected.txt: Added.
        * platform/mac/fast/css/font-face-multiple-faces-expected.checksum: Added.
        * platform/mac/fast/css/font-face-multiple-faces-expected.png: Added.
        * platform/mac/fast/css/font-face-multiple-faces-expected.txt: Added.
        * platform/win/Skipped: Removed css2.1/t1506-c525-font-wt-00-b.html.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7576c03d
2008-06-25 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- tests for https://bugs.webkit.org/show_bug.cgi?id=18863
<rdar://problem/5908890> weight mappings with @font-face aren't consistent
* fast/css/font-face-locally-installed.html: Added.
* fast/css/font-face-multiple-faces.html: Added.
* platform/mac/fast/css/font-face-locally-installed-expected.checksum: Added.
* platform/mac/fast/css/font-face-locally-installed-expected.png: Added.
* platform/mac/fast/css/font-face-locally-installed-expected.txt: Added.
* platform/mac/fast/css/font-face-multiple-faces-expected.checksum: Added.
* platform/mac/fast/css/font-face-multiple-faces-expected.png: Added.
* platform/mac/fast/css/font-face-multiple-faces-expected.txt: Added.
* platform/win/Skipped: Removed css2.1/t1506-c525-font-wt-00-b.html.
2008-06-24 Anonymous
Reviewed by Darin Adler. Committed by Adam Barth.
<style>
@font-face {
font-family: 'Lucida Grande';
font-style: italic;
src: local(Times);
}
@font-face {
font-family: Helvetica;
font-weight: 400;
src: local(Times);
}
@font-face {
font-family: Monaco;
unicode-range: U+0060-0080;
src: local(Times);
}
</style>
<p>
This tests that locally-installed fonts are used for a family of the same
name defined in a <tt>@font-face</tt> rule if they are a better match than
the rule.
</p>
<p style="font-family: Lucida Grande;">
This should be Lucida Grande <i>and this should be Times Italic.</i>
</p>
<p style="font-family: Helvetica;">
This should be Times <b>and this should be Helvetica Bold.</b>
</p>
<p style="font-family: Monaco;">
UPPERCASE SHOULD BE MONACO and lowecase should be times.
</p>
<style>
@font-face {
font-family: webkit-one;
font-style: italic;
src: local(Courier);
}
@font-face {
font-family: webkit-one;
font-style: normal;
src: local(Helvetica);
}
@font-face {
font-family: webkit-one;
font-style: italic;
font-weight: 700;
src: local(Papyrus);
}
@font-face {
font-family: webkit-two;
font-style: italic;
src: url(resources/Ahem.ttf);
}
@font-face {
font-family: webkit-three;
src: url(resources/Ahem.ttf);
}
@font-face {
font-family: webkit-four;
font-style: normal;
src: url(resources/Ahem.ttf);
}
@font-face {
font-family: webkit-five;
font-weight: 100;
src: url(resources/Ahem.ttf);
}
@font-face {
font-family: webkit-six;
font-weight: 400;
src: local(Courier);
}
@font-face {
font-family: webkit-six;
font-weight: 700;
src: local(Helvetica);
}
@font-face {
font-family: webkit-six;
font-weight: 900;
src: local(Papyrus);
}
@font-face {
font-family: webkit-seven;
font-weight: 300;
src: local(Courier);
}
@font-face {
font-family: webkit-seven;
font-weight: 600;
src: local(Helvetica);
}
@font-face {
font-family: webkit-eight;
font-weight: 100;
src: local(Courier);
}
@font-face {
font-family: webkit-eight;
font-weight: 900;
src: local(Helvetica);
}
div { border: 1px solid lightblue; margin: 4px; }
</style>
<p>
Each font name in that font:
</p>
<div style="font-family: webkit-one;">
<b>Helvetica bold</b> Helvetica <i>Courier syn. italic <b>Papyrus syn. bold syn. italic</b></i>
</div>
<div style="font-family: webkit-six;">
<span style="font-weight: 100">Courier</span>
<span style="font-weight: 200">Courier</span>
<span style="font-weight: 300">Courier</span>
<span style="font-weight: 400">Courier</span>
<span style="font-weight: 500">Courier</span>
<span style="font-weight: 600">Helvetica Bold</span>
<span style="font-weight: 700">Helvetica Bold</span>
<span style="font-weight: 800">Papyrus syn. bold</span>
<span style="font-weight: 900">Papyrus syn. bold</span>
</div>
<div style="font-family: webkit-seven;">
<span style="font-weight: 100">Courier</span>
<span style="font-weight: 200">Courier</span>
<span style="font-weight: 300">Courier</span>
<span style="font-weight: 400">Courier</span>
<span style="font-weight: 500">Courier</span>
<span style="font-weight: 600">Helvetica Bold</span>
<span style="font-weight: 700">Helvetica Bold</span>
<span style="font-weight: 800">Helvetica Bold</span>
<span style="font-weight: 900">Helvetica Bold</span>
</div>
<div style="font-family: webkit-eight;">
<span style="font-weight: 100">Courier</span>
<span style="font-weight: 200">Courier</span>
<span style="font-weight: 300">Courier</span>
<span style="font-weight: 400">Courier</span>
<span style="font-weight: 500">Courier</span>
<span style="font-weight: 600">Helvetica Bold</span>
<span style="font-weight: 700">Helvetica Bold</span>
<span style="font-weight: 800">Helvetica Bold</span>
<span style="font-weight: 900">Helvetica Bold</span>
</div>
<p>Times followed by Ahem (normal):</p>
<div style="font-family: webkit-two;">
Times <i>AHEM</i>
</div>
<p>Ahem (normal):</p>
<div style="font-family: webkit-three;">
AHEM <i>AHEM</i>
</div>
<p>Ahem (normal) followed by Ahem (synthetic bold):</p>
<div style="font-family: webkit-five;">
AHEM <b>AHEM</b>
</div>
<p>Ahem (normal) followed by Ahem (synthetic italics):</p>
<div style="font-family: webkit-four;">
AHEM <i>AHEM</i>
</div>
49fabda1db15ed69183bb5105726b37c
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 553x18
text run at (0,0) width 437: "This tests that locally-installed fonts are used for a family of the same "
text run at (437,0) width 116: "name defined in a "
RenderInline {TT} at (0,0) size 80x15
RenderText {#text} at (553,2) size 80x15
text run at (553,2) width 80: "@font-face"
RenderText {#text} at (633,0) size 778x36
text run at (633,0) width 145: " rule if they are a better"
text run at (0,18) width 73: "match than "
text run at (73,18) width 51: "the rule."
RenderBlock {P} at (0,52) size 784x19
RenderText {#text} at (0,0) size 237x18
text run at (0,0) width 237: "This should be Lucida Grande "
RenderInline {I} at (0,0) size 197x18
RenderText {#text} at (237,1) size 197x18
text run at (237,1) width 197: "and this should be Times Italic."
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,87) size 784x18
RenderText {#text} at (0,0) size 140x18
text run at (0,0) width 140: "This should be Times "
RenderInline {B} at (0,0) size 259x18
RenderText {#text} at (140,0) size 259x18
text run at (140,0) width 259: "and this should be Helvetica Bold."
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,121) size 784x21
RenderText {#text} at (0,0) size 491x20
text run at (0,0) width 491: "UPPERCASE SHOULD BE MONACO and lowecase should be times."
9f5a96e6640bb42d3c164ce9f48b9211
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 175x18
text run at (0,0) width 175: "Each font name in that font:"
RenderBlock {DIV} at (4,34) size 776x27 [border: (1px solid #ADD8E6)]
RenderInline {B} at (0,0) size 108x18
RenderText {#text} at (1,2) size 108x18
text run at (1,2) width 108: "Helvetica bold"
RenderText {#text} at (109,2) size 75x18
text run at (109,2) width 75: " Helvetica "
RenderInline {I} at (0,0) size 433x18
RenderText {#text} at (184,2) size 200x18
text run at (184,2) width 200: "Courier syn. italic "
RenderInline {B} at (0,0) size 233x25
RenderText {#text} at (384,1) size 233x25
text run at (384,1) width 233: "Papyrus syn. bold syn. italic"
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (4,65) size 776x52 [border: (1px solid #ADD8E6)]
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (1,2) size 70x18
text run at (1,2) width 70: "Courier"
RenderText {#text} at (71,2) size 10x18
text run at (71,2) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (81,2) size 70x18
text run at (81,2) width 70: "Courier"
RenderText {#text} at (151,2) size 10x18
text run at (151,2) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (161,2) size 70x18
text run at (161,2) width 70: "Courier"
RenderText {#text} at (231,2) size 10x18
text run at (231,2) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (241,2) size 70x18
text run at (241,2) width 70: "Courier"
RenderText {#text} at (311,2) size 10x18
text run at (311,2) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (321,2) size 70x18
text run at (321,2) width 70: "Courier"
RenderText {#text} at (391,2) size 10x18
text run at (391,2) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (401,2) size 110x18
text run at (401,2) width 110: "Helvetica Bold"
RenderText {#text} at (511,2) size 10x18
text run at (511,2) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (521,2) size 110x18
text run at (521,2) width 110: "Helvetica Bold"
RenderText {#text} at (631,2) size 10x18
text run at (631,2) width 10: " "
RenderInline {SPAN} at (0,0) size 747x50
RenderText {#text} at (641,1) size 747x50
text run at (641,1) width 107: "Papyrus syn."
text run at (1,26) width 38: "bold"
RenderText {#text} at (39,27) size 10x18
text run at (39,27) width 10: " "
RenderInline {SPAN} at (0,0) size 150x25
RenderText {#text} at (49,26) size 150x25
text run at (49,26) width 150: "Papyrus syn. bold"
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (4,121) size 776x38 [border: (1px solid #ADD8E6)]
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (1,1) size 70x18
text run at (1,1) width 70: "Courier"
RenderText {#text} at (71,1) size 10x18
text run at (71,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (81,1) size 70x18
text run at (81,1) width 70: "Courier"
RenderText {#text} at (151,1) size 10x18
text run at (151,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (161,1) size 70x18
text run at (161,1) width 70: "Courier"
RenderText {#text} at (231,1) size 10x18
text run at (231,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (241,1) size 70x18
text run at (241,1) width 70: "Courier"
RenderText {#text} at (311,1) size 10x18
text run at (311,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (321,1) size 70x18
text run at (321,1) width 70: "Courier"
RenderText {#text} at (391,1) size 10x18
text run at (391,1) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (401,1) size 110x18
text run at (401,1) width 110: "Helvetica Bold"
RenderText {#text} at (511,1) size 10x18
text run at (511,1) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (521,1) size 110x18
text run at (521,1) width 110: "Helvetica Bold"
RenderText {#text} at (631,1) size 10x18
text run at (631,1) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (641,1) size 110x18
text run at (641,1) width 110: "Helvetica Bold"
RenderText {#text} at (0,0) size 0x0
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (1,19) size 110x18
text run at (1,19) width 110: "Helvetica Bold"
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (4,163) size 776x38 [border: (1px solid #ADD8E6)]
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (1,1) size 70x18
text run at (1,1) width 70: "Courier"
RenderText {#text} at (71,1) size 10x18
text run at (71,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (81,1) size 70x18
text run at (81,1) width 70: "Courier"
RenderText {#text} at (151,1) size 10x18
text run at (151,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (161,1) size 70x18
text run at (161,1) width 70: "Courier"
RenderText {#text} at (231,1) size 10x18
text run at (231,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (241,1) size 70x18
text run at (241,1) width 70: "Courier"
RenderText {#text} at (311,1) size 10x18
text run at (311,1) width 10: " "
RenderInline {SPAN} at (0,0) size 70x18
RenderText {#text} at (321,1) size 70x18
text run at (321,1) width 70: "Courier"
RenderText {#text} at (391,1) size 10x18
text run at (391,1) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (401,1) size 110x18
text run at (401,1) width 110: "Helvetica Bold"
RenderText {#text} at (511,1) size 10x18
text run at (511,1) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (521,1) size 110x18
text run at (521,1) width 110: "Helvetica Bold"
RenderText {#text} at (631,1) size 10x18
text run at (631,1) width 10: " "
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (641,1) size 110x18
text run at (641,1) width 110: "Helvetica Bold"
RenderText {#text} at (0,0) size 0x0
RenderInline {SPAN} at (0,0) size 110x18
RenderText {#text} at (1,19) size 110x18
text run at (1,19) width 110: "Helvetica Bold"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,217) size 784x18
RenderText {#text} at (0,0) size 224x18
text run at (0,0) width 224: "Times followed by Ahem (normal):"
RenderBlock {DIV} at (4,251) size 776x20 [border: (1px solid #ADD8E6)]
RenderText {#text} at (1,1) size 43x18
text run at (1,1) width 43: "Times "
RenderInline {I} at (0,0) size 64x16
RenderText {#text} at (44,2) size 64x16
text run at (44,2) width 64: "AHEM"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,287) size 784x18
RenderText {#text} at (0,0) size 101x18
text run at (0,0) width 101: "Ahem (normal):"
RenderBlock {DIV} at (4,321) size 776x18 [border: (1px solid #ADD8E6)]
RenderText {#text} at (1,1) size 80x16
text run at (1,1) width 80: "AHEM "
RenderInline {I} at (0,0) size 64x16
RenderText {#text} at (81,1) size 64x16
text run at (81,1) width 64: "AHEM"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,355) size 784x18
RenderText {#text} at (0,0) size 326x18
text run at (0,0) width 326: "Ahem (normal) followed by Ahem (synthetic bold):"
RenderBlock {DIV} at (4,389) size 776x18 [border: (1px solid #ADD8E6)]
RenderText {#text} at (1,1) size 80x16
text run at (1,1) width 80: "AHEM "
RenderInline {B} at (0,0) size 68x16
RenderText {#text} at (81,1) size 68x16
text run at (81,1) width 68: "AHEM"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,423) size 784x18
RenderText {#text} at (0,0) size 334x18
text run at (0,0) width 334: "Ahem (normal) followed by Ahem (synthetic italics):"
RenderBlock {DIV} at (4,457) size 776x18 [border: (1px solid #ADD8E6)]
RenderText {#text} at (1,1) size 80x16
text run at (1,1) width 80: "AHEM "
RenderInline {I} at (0,0) size 64x16
RenderText {#text} at (81,1) size 64x16
text run at (81,1) width 64: "AHEM"
RenderText {#text} at (0,0) size 0x0
......@@ -332,9 +332,6 @@ fast/frames/viewsource-empty-attribute-value.html
# <rdar://5848161> REGRESSION (r31438?): Crash beneath ResourceHandle::setDefersLoading (null CFURLConnection)
fast/loader/simultaneous-reloads-assert.html
# <rdar://problem/5873639> REGRESSION (r31620): css2.1/t1506-c525-font-wt-00-b fails on Windows
css2.1/t1506-c525-font-wt-00-b.html
################################################################################
####################### No bugs filed about the below yet#######################
################################################################################
......
2008-06-25 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- fix <rdar://problem/5873639> REGRESSION (r31620): css2.1/t1506-c525-font-wt-00-b fails on Windows
- fix https://bugs.webkit.org/show_bug.cgi?id=18863
<rdar://problem/5908890> weight mappings with @font-face aren't consistent
Tests: fast/css/font-face-locally-installed.html
fast/css/font-face-multiple-faces.html
* WebCore.vcproj/WebCore.vcproj: Added FontTraitsMask.h.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* css/CSSFontFace.h:
Made CSSFontFace store descriptors from the @font-face rule, as follows:
(WebCore::CSSFontFace::create): Added a FontTraitsMask argument.
(WebCore::CSSFontFace::traitsMask): Added this accessor.
(WebCore::CSSFontFace::addRange): Added.
(WebCore::CSSFontFace::ranges): Added.
(WebCore::CSSFontFace::UnicodeRange::UnicodeRange):
(WebCore::CSSFontFace::UnicodeRange::from):
(WebCore::CSSFontFace::UnicodeRange::to):
(WebCore::CSSFontFace::CSSFontFace): Added a FontTraitsMask and a vector
of UnicodeRanges as member variables.
* css/CSSFontFaceSource.cpp:
Changed the hash key from the font size alone to the font size and
the synthetic style bits, needed if the same source supplies different
synthesized versions.
(WebCore::CSSFontFaceSource::pruneTable):
(WebCore::CSSFontFaceSource::getFontData):
* css/CSSFontFaceSource.h:
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::~CSSFontSelector): Added code to delete
the contents of the font face, locally-installed font face and segmented
font tables.
(WebCore::CSSFontSelector::addFontFaceRule): Changed this function to
not create segmented font faces, but instead just collect font faces
and annotate them with descriptors (traits and unicode ranges).
(WebCore::compareFontFaces): Added. Used in getFontData() to sort the
font faces by proximity to the desired traits.
(WebCore::CSSFontSelector::getFontData): Changed to create the segmented
font face here and cache it.
* css/CSSFontSelector.h:
* css/CSSSegmentedFontFace.cpp:
Changed to keep a vector of font faces instead of font face ranges, as
font faces now know their Unicode ranges.
(WebCore::CSSSegmentedFontFace::~CSSSegmentedFontFace):
(WebCore::CSSSegmentedFontFace::isLoaded):
(WebCore::CSSSegmentedFontFace::isValid):
(WebCore::CSSSegmentedFontFace::appendFontFace):
(WebCore::CSSSegmentedFontFace::getFontData): Removed the synthetic
traits parameters, and instead changed to set them on each FontData
separately based on the difference between the desired traits and
the font face's traits.
* css/CSSSegmentedFontFace.h:
* platform/graphics/FontCache.h:
Removed fontExists() and added getTraitsInFamily().
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::traitsMask): Added.
* platform/graphics/FontDescription.h:
* platform/graphics/FontTraitsMask.h: Added.
* platform/graphics/GlyphPageTreeNode.cpp:
(WebCore::GlyphPageTreeNode::initializePage): Changed to fill in with
glyphs from all fonts in the segmented font, using each font in turn to
fill in characters not covered by earlier fonts.
* platform/graphics/gtk/FontCacheGtk.cpp:
(WebCore::FontCache::getTraitsInFamily): Added a stub.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::getTraitsInFamily): Added.
* platform/graphics/qt/FontCacheQt.cpp:
(WebCore::FontCache::getTraitsInFamily): Added a stub.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::TraitsInFamilyProcData::TraitsInFamilyProcData): Added.
(WebCore::traitsInFamilyEnumProc): Added.
(WebCore::FontCache::getTraitsInFamily): Added.
* platform/graphics/wx/FontCacheWx.cpp:
(WebCore::FontCache::getTraitsInFamily): Added a stub.
* platform/mac/WebFontCache.h:
* platform/mac/WebFontCache.mm:
(toTraitsMask): Added.
(+[WebFontCache getTraits:inFamily:]): Added.
2008-06-24 Anonymous
Reviewed by Darin Adler. Committed by Adam Barth.
......@@ -4988,6 +4988,10 @@
RelativePath="..\platform\graphics\FontSelector.h"
>
</File>
<File
RelativePath="..\platform\graphics\FontTraitsMask.h"
>
</File>
<File
RelativePath="..\platform\graphics\GeneratedImage.cpp"
>
......
......@@ -397,6 +397,7 @@
371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */; };
371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */; };
3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */; };
3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */; settings = {ATTRIBUTES = (Private, ); }; };
37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; };
37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; };
37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -4912,6 +4913,7 @@
371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSUnicodeRangeValue.h; sourceTree = "<group>"; };
371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnicodeRangeValue.cpp; sourceTree = "<group>"; };
3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGlyphMap.h; sourceTree = "<group>"; };
3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontTraitsMask.h; sourceTree = "<group>"; };
37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; };
37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; };
37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; };
......@@ -12076,6 +12078,7 @@
B2C3DA590D006CD600EF6F26 /* FontFamily.h */,
37ACCE410DA2980F0089E602 /* FontRenderingMode.h */,
B2C3DA5A0D006CD600EF6F26 /* FontSelector.h */,
3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */,
B2C3DA5B0D006CD600EF6F26 /* GlyphBuffer.h */,
B2C3DA5C0D006CD600EF6F26 /* GlyphPageTreeNode.cpp */,
B2C3DA5D0D006CD600EF6F26 /* GlyphPageTreeNode.h */,
......@@ -15267,6 +15270,7 @@
BC686CB50E0C343900DE8A08 /* DOMCSSVariablesRule.h in Headers */,
BC686CBB0E0C349D00DE8A08 /* DOMCSSVariablesDeclarationInternal.h in Headers */,
BC686CBC0E0C349D00DE8A08 /* DOMCSSVariablesRuleInternal.h in Headers */,
3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -26,10 +26,12 @@
#ifndef CSSFontFace_h
#define CSSFontFace_h
#include "FontTraitsMask.h"
#include <wtf/HashSet.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/unicode/Unicode.h>
namespace WebCore {
......@@ -40,9 +42,16 @@ class SimpleFontData;
class CSSFontFace : public RefCounted<CSSFontFace> {
public:
static PassRefPtr<CSSFontFace> create() { return adoptRef(new CSSFontFace); }
static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask) { return adoptRef(new CSSFontFace(traitsMask)); }
~CSSFontFace();
FontTraitsMask traitsMask() const { return m_traitsMask; }
struct UnicodeRange;
void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }