Reviewed by Sam Weinig.
- change the interpretation of unicode-range values in "from-to" form
to include the "to" character.
Test: fast/css/font-face-unicode-range.html
* css/CSSParser.cpp:
(WebCore::CSSParser::parseFontFaceUnicodeRange):
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::overlayRange):
* platform/graphics/GlyphPageTreeNode.cpp:
(WebCore::GlyphPageTreeNode::initializePage):
* platform/graphics/SegmentedFontData.cpp:
(WebCore::SegmentedFontData::fontDataForCharacter):
(WebCore::SegmentedFontData::containsCharacters):
LayoutTests:
Reviewed by Sam Weinig.
- add a test for the unicode-range @font-face property
- update @font-face rules in existing tests after changing unicode-range
values in "from-to" form to include the "to" character
* fast/css/font-face-unicode-range.html: Added.
* fast/css/rtl-ordering.html:
* fast/text/international/resources/Mac-compatible-font-fallback.css:
* platform/mac-leopard/fast/css/font-face-unicode-range-expected.checksum: Added.
* platform/mac-leopard/fast/css/font-face-unicode-range-expected.png: Added.
* platform/mac/fast/css/font-face-unicode-range-expected.txt: Added.
* platform/win/css2.1/resources/Mac-compatible-font-fallback.css:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29884
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-01-30 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - add a test for the unicode-range @font-face property
+ - update @font-face rules in existing tests after changing unicode-range
+ values in "from-to" form to include the "to" character
+
+ * fast/css/font-face-unicode-range.html: Added.
+ * fast/css/rtl-ordering.html:
+ * fast/text/international/resources/Mac-compatible-font-fallback.css:
+ * platform/mac-leopard/fast/css/font-face-unicode-range-expected.checksum: Added.
+ * platform/mac-leopard/fast/css/font-face-unicode-range-expected.png: Added.
+ * platform/mac/fast/css/font-face-unicode-range-expected.txt: Added.
+ * platform/win/css2.1/resources/Mac-compatible-font-fallback.css:
+
2008-01-30 Justin Garcia <justin.garcia@apple.com>
Reviewed by Darin Adler.
--- /dev/null
+<head>
+ <style>
+ div { border: 1px solid; padding: 0 8px; margin: 8px 0; }
+ span.ahem { font-family: 'Ahem'; }
+ span.courier { font-family: 'Courier'; }
+
+ @font-face {
+ font-family: 'test1';
+ src: local('Times');
+ }
+ @font-face {
+ font-family: 'test1';
+ src: url('resources/Ahem.ttf');
+ unicode-range: U+0041;
+ }
+
+ @font-face {
+ font-family: 'test2';
+ src: local('Times');
+ }
+ @font-face {
+ font-family: 'test2';
+ src: url('resources/Ahem.ttf');
+ unicode-range: U+004?;
+ }
+
+ @font-face {
+ font-family: 'test3';
+ src: local('Times');
+ }
+ @font-face {
+ font-family: 'test3';
+ src: url('resources/Ahem.ttf');
+ unicode-range: U+0042-0044;
+ }
+
+ @font-face {
+ font-family: 'test4';
+ src: local('Times');
+ }
+ @font-face {
+ font-family: 'test4';
+ src: url('resources/Ahem.ttf');
+ unicode-range: U+0050-0058;
+ }
+ @font-face {
+ font-family: 'test4';
+ src: local('Courier');
+ unicode-range: U+004F-0051;
+ }
+
+ @font-face {
+ font-family: 'test5';
+ src: local('Times');
+ }
+ @font-face {
+ font-family: 'test5';
+ src: url('resources/Ahem.ttf');
+ unicode-range: U+0050-0058;
+ }
+ @font-face {
+ font-family: 'test5';
+ src: local('Courier');
+ unicode-range: U+0052-0055;
+ }
+ </style>
+</head>
+<body onload="finished()">
+ <p>
+ Each box should contain two identical lines
+ </p>
+
+ <div>
+ <p style="font-family: 'test1';">
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ <p>
+ <span class="ahem">A</span>BCDEFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ </div>
+
+ <div>
+ <p style="font-family: 'test2';">
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ <p>
+ <span class="ahem">ABCDEFGHIJKLMNO</span>PQRSTUVWXYZ
+ </p>
+ </div>
+
+ <div>
+ <p style="font-family: 'test3';">
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ <p>
+ A<span class="ahem">BCD</span>EFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ </div>
+
+ <div>
+ <p style="font-family: 'test4';">
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ <p>
+ ABCDEFGHIJKLMN<span class="courier">OPQ</span><span class="ahem">RSTUVWX</span>YZ
+ </p>
+ </div>
+
+ <div>
+ <p style="font-family: 'test5';">
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ </p>
+ <p>
+ ABCDEFGHIJKLMNO<span class="ahem">PQ<span class="courier">RSTU</span>VWX</span>YZ
+ </p>
+ </div>
+ <script>
+ function finished()
+ {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+
+ document.body.offsetTop;
+
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+ </script>
+</body>
font-family: 'times';
src: local('Lucida Grande');
/* Hebrew */
- unicode-range: U+0590-0600;
+ unicode-range: U+0590-05FF;
}
</style>
</head>
@font-face {
font-family: 'times';
src: local('Lucida Grande');
- unicode-range: U+0590-0600;
+ unicode-range: U+0590-05FF;
}
--- /dev/null
+3313b7a12ad2033b06682453531d627a
\ No newline at end of file
--- /dev/null
+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 274x18
+ text run at (0,0) width 274: "Each box should contain two identical lines"
+ RenderBlock {DIV} at (0,34) size 784x86 [border: (1px solid #000000)]
+ RenderBlock {P} at (9,17) size 766x18
+ RenderText {#text} at (0,0) size 288x18
+ text run at (0,0) width 288: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {P} at (9,51) size 766x18
+ RenderInline {SPAN} at (0,0) size 16x16
+ RenderText {#text} at (0,1) size 16x16
+ text run at (0,1) width 16: "A"
+ RenderText {#text} at (16,0) size 272x18
+ text run at (16,0) width 272: "BCDEFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {DIV} at (0,128) size 784x86 [border: (1px solid #000000)]
+ RenderBlock {P} at (9,17) size 766x18
+ RenderText {#text} at (0,0) size 364x18
+ text run at (0,0) width 364: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {P} at (9,51) size 766x18
+ RenderInline {SPAN} at (0,0) size 240x16
+ RenderText {#text} at (0,1) size 240x16
+ text run at (0,1) width 240: "ABCDEFGHIJKLMNO"
+ RenderText {#text} at (240,0) size 124x18
+ text run at (240,0) width 124: "PQRSTUVWXYZ"
+ RenderBlock {DIV} at (0,222) size 784x86 [border: (1px solid #000000)]
+ RenderBlock {P} at (9,17) size 766x18
+ RenderText {#text} at (0,0) size 298x18
+ text run at (0,0) width 298: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {P} at (9,51) size 766x18
+ RenderText {#text} at (0,0) size 12x18
+ text run at (0,0) width 12: "A"
+ RenderInline {SPAN} at (0,0) size 48x16
+ RenderText {#text} at (12,1) size 48x16
+ text run at (12,1) width 48: "BCD"
+ RenderText {#text} at (60,0) size 238x18
+ text run at (60,0) width 238: "EFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {DIV} at (0,316) size 784x86 [border: (1px solid #000000)]
+ RenderBlock {P} at (9,17) size 766x18
+ RenderText {#text} at (0,0) size 312x18
+ text run at (0,0) width 312: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {P} at (9,51) size 766x18
+ RenderText {#text} at (0,0) size 148x18
+ text run at (0,0) width 148: "ABCDEFGHIJKLMN"
+ RenderInline {SPAN} at (0,0) size 30x18
+ RenderText {#text} at (148,0) size 30x18
+ text run at (148,0) width 30: "OPQ"
+ RenderInline {SPAN} at (0,0) size 112x16
+ RenderText {#text} at (178,1) size 112x16
+ text run at (178,1) width 112: "RSTUVWX"
+ RenderText {#text} at (290,0) size 22x18
+ text run at (290,0) width 22: "YZ"
+ RenderBlock {DIV} at (0,410) size 784x86 [border: (1px solid #000000)]
+ RenderBlock {P} at (9,17) size 766x18
+ RenderText {#text} at (0,0) size 302x18
+ text run at (0,0) width 302: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ RenderBlock {P} at (9,51) size 766x18
+ RenderText {#text} at (0,0) size 160x18
+ text run at (0,0) width 160: "ABCDEFGHIJKLMNO"
+ RenderInline {SPAN} at (0,0) size 120x16
+ RenderText {#text} at (160,1) size 32x16
+ text run at (160,1) width 32: "PQ"
+ RenderInline {SPAN} at (0,0) size 40x18
+ RenderText {#text} at (192,0) size 40x18
+ text run at (192,0) width 40: "RSTU"
+ RenderText {#text} at (232,1) size 48x16
+ text run at (232,1) width 48: "VWX"
+ RenderText {#text} at (280,0) size 22x18
+ text run at (280,0) width 22: "YZ"
@font-face {
font-family: 'times' '-webkit-serif';
src: local('WebKit Layout Tests');
- unicode-range: U+21E6-21EA U+25FE U+262F U+2798-279B;
+ unicode-range: U+21E6-21E9 U+25FE U+262F U+2798-279A;
}
/* Hebrew, hyphen, non-breaking hyphen, upwards white arrow,
@font-face {
font-family: 'times';
src: local('Lucida Grande');
- unicode-range: U+0590-0600 U+2010-2011 U+21E7 U+25A0 U+25E6 U+FFFD;
+ unicode-range: U+0590-05FF U+2010-2011 U+21E7 U+25A0 U+25E6 U+FFFD;
}
2008-01-30 Dan Bernstein <mitz@apple.com>
+ Reviewed by Sam Weinig.
+
+ - change the interpretation of unicode-range values in "from-to" form
+ to include the "to" character.
+
+ Test: fast/css/font-face-unicode-range.html
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseFontFaceUnicodeRange):
+ * css/CSSSegmentedFontFace.cpp:
+ (WebCore::CSSSegmentedFontFace::overlayRange):
+ * platform/graphics/GlyphPageTreeNode.cpp:
+ (WebCore::GlyphPageTreeNode::initializePage):
+ * platform/graphics/SegmentedFontData.cpp:
+ (WebCore::SegmentedFontData::fontDataForCharacter):
+ (WebCore::SegmentedFontData::containsCharacters):
+
+2008-01-30 Dan Bernstein <mitz@apple.com>
+
Reviewed by Darin Adler.
- prune references to custom fonts' SimpleFontData from the glyph page
break;
if (i == length)
- to = from + 1;
+ to = from;
else if (rangeString[i] == '?') {
unsigned span = 1;
while (i < length && rangeString[i] == '?') {
}
if (i < length)
failed = true;
- to = from + span;
+ to = from + span - 1;
} else {
if (length < i + 2) {
failed = true;
m_ranges.clear();
for (unsigned i = 0; i < size; i++) {
const FontFaceRange& range = oldRanges[i];
- if (range.from() >= to || range.to() <= from)
+ if (range.from() > to || range.to() < from)
m_ranges.append(range);
else if (range.from() < from) {
- m_ranges.append(FontFaceRange(range.from(), from, range.fontFace()));
+ m_ranges.append(FontFaceRange(range.from(), from - 1, range.fontFace()));
if (range.to() > to)
- m_ranges.append(FontFaceRange(to, range.to(), range.fontFace()));
+ m_ranges.append(FontFaceRange(to + 1, range.to(), range.fontFace()));
} else if (range.to() > to)
- m_ranges.append(FontFaceRange(to, range.to(), range.fontFace()));
+ m_ranges.append(FontFaceRange(to + 1, range.to(), range.fontFace()));
}
}
m_ranges.append(FontFaceRange(from, to, fontFace));
for (unsigned i = 0; i < numRanges; i++) {
const FontDataRange& range = segmentedFontData->rangeAt(i);
int from = max(0, range.from() - static_cast<int>(start));
- int to = min(range.to() - static_cast<int>(start), static_cast<int>(GlyphPage::size));
+ int to = 1 + min(range.to() - static_cast<int>(start), static_cast<int>(GlyphPage::size) - 1);
if (from < static_cast<int>(GlyphPage::size) && to > 0) {
if (!zeroFilled) {
if (from > 0 || to < static_cast<int>(GlyphPage::size)) {
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
- if (it->from() <= c && it->to() > c)
+ if (it->from() <= c && it->to() >= c)
return it->fontData();
}
return m_ranges[0].fontData();
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
- if (it->from() <= characters[0] && it->to() > characters[0])
+ if (it->from() <= characters[0] && it->to() >= characters[0])
return true;
}
return false;