OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return; | 86 return; |
87 | 87 |
88 FontDescriptionChangeScope scope(this); | 88 FontDescriptionChangeScope scope(this); |
89 | 89 |
90 scope.reset(); | 90 scope.reset(); |
91 scope.fontDescription().setGenericFamily(FontDescription::StandardFamily); | 91 scope.fontDescription().setGenericFamily(FontDescription::StandardFamily); |
92 scope.fontDescription().setUsePrinterFont(m_document->printing()); | 92 scope.fontDescription().setUsePrinterFont(m_document->printing()); |
93 const AtomicString& standardFontFamily = m_document->settings()->genericFont
FamilySettings().standard(); | 93 const AtomicString& standardFontFamily = m_document->settings()->genericFont
FamilySettings().standard(); |
94 if (!standardFontFamily.isEmpty()) { | 94 if (!standardFontFamily.isEmpty()) { |
95 scope.fontDescription().firstFamily().setFamily(standardFontFamily); | 95 scope.fontDescription().firstFamily().setFamily(standardFontFamily); |
96 scope.fontDescription().firstFamily().appendFamily(0); | 96 scope.fontDescription().firstFamily().appendFamily(nullptr); |
97 } | 97 } |
98 scope.fontDescription().setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1)
; | 98 scope.fontDescription().setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1)
; |
99 setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword
(m_document, CSSValueMedium, false)); | 99 setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword
(m_document, CSSValueMedium, false)); |
100 } | 100 } |
101 | 101 |
102 void FontBuilder::inheritFrom(const FontDescription& fontDescription) | 102 void FontBuilder::inheritFrom(const FontDescription& fontDescription) |
103 { | 103 { |
104 FontDescriptionChangeScope scope(this); | 104 FontDescriptionChangeScope scope(this); |
105 | 105 |
106 scope.set(fontDescription); | 106 scope.set(fontDescription); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 break; | 212 break; |
213 default: | 213 default: |
214 break; | 214 break; |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 if (!face.isEmpty()) { | 218 if (!face.isEmpty()) { |
219 if (!currFamily) { | 219 if (!currFamily) { |
220 // Filling in the first family. | 220 // Filling in the first family. |
221 firstFamily.setFamily(face); | 221 firstFamily.setFamily(face); |
222 firstFamily.appendFamily(0); // Remove any inherited family-fall
back list. | 222 firstFamily.appendFamily(nullptr); // Remove any inherited famil
y-fallback list. |
223 currFamily = &firstFamily; | 223 currFamily = &firstFamily; |
224 scope.fontDescription().setIsSpecifiedFont(scope.fontDescription
().genericFamily() == FontDescription::NoFamily); | 224 scope.fontDescription().setIsSpecifiedFont(scope.fontDescription
().genericFamily() == FontDescription::NoFamily); |
225 } else { | 225 } else { |
226 RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); | 226 RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); |
227 newFamily->setFamily(face); | 227 newFamily->setFamily(face); |
228 currFamily->appendFamily(newFamily); | 228 currFamily->appendFamily(newFamily); |
229 currFamily = newFamily.get(); | 229 currFamily = newFamily.get(); |
230 } | 230 } |
231 } | 231 } |
232 } | 232 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 void FontBuilder::createFontForDocument(PassRefPtr<FontSelector> fontSelector, R
enderStyle* documentStyle) | 647 void FontBuilder::createFontForDocument(PassRefPtr<FontSelector> fontSelector, R
enderStyle* documentStyle) |
648 { | 648 { |
649 FontDescription fontDescription = FontDescription(); | 649 FontDescription fontDescription = FontDescription(); |
650 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->
locale())); | 650 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->
locale())); |
651 if (Settings* settings = m_document->settings()) { | 651 if (Settings* settings = m_document->settings()) { |
652 fontDescription.setUsePrinterFont(m_document->printing()); | 652 fontDescription.setUsePrinterFont(m_document->printing()); |
653 const AtomicString& standardFont = settings->genericFontFamilySettings()
.standard(fontDescription.script()); | 653 const AtomicString& standardFont = settings->genericFontFamilySettings()
.standard(fontDescription.script()); |
654 if (!standardFont.isEmpty()) { | 654 if (!standardFont.isEmpty()) { |
655 fontDescription.setGenericFamily(FontDescription::StandardFamily); | 655 fontDescription.setGenericFamily(FontDescription::StandardFamily); |
656 fontDescription.firstFamily().setFamily(standardFont); | 656 fontDescription.firstFamily().setFamily(standardFont); |
657 fontDescription.firstFamily().appendFamily(0); | 657 fontDescription.firstFamily().appendFamily(nullptr); |
658 } | 658 } |
659 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); | 659 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); |
660 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, fals
e); | 660 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, fals
e); |
661 fontDescription.setSpecifiedSize(size); | 661 fontDescription.setSpecifiedSize(size); |
662 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDes
cription, documentStyle->effectiveZoom(), size)); | 662 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDes
cription, documentStyle->effectiveZoom(), size)); |
663 } else { | 663 } else { |
664 fontDescription.setUsePrinterFont(m_document->printing()); | 664 fontDescription.setUsePrinterFont(m_document->printing()); |
665 } | 665 } |
666 | 666 |
667 FontOrientation fontOrientation; | 667 FontOrientation fontOrientation; |
668 NonCJKGlyphOrientation glyphOrientation; | 668 NonCJKGlyphOrientation glyphOrientation; |
669 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 669 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
670 fontDescription.setOrientation(fontOrientation); | 670 fontDescription.setOrientation(fontOrientation); |
671 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 671 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
672 documentStyle->setFontDescription(fontDescription); | 672 documentStyle->setFontDescription(fontDescription); |
673 documentStyle->font().update(fontSelector); | 673 documentStyle->font().update(fontSelector); |
674 } | 674 } |
675 | 675 |
676 } | 676 } |
OLD | NEW |