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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void FontBuilder::setInitial(float effectiveZoom) | 95 void FontBuilder::setInitial(float effectiveZoom) |
96 { | 96 { |
97 ASSERT(m_document && m_document->settings()); | 97 ASSERT(m_document && m_document->settings()); |
98 if (!m_document || !m_document->settings()) | 98 if (!m_document || !m_document->settings()) |
99 return; | 99 return; |
100 | 100 |
101 FontDescriptionChangeScope scope(this); | 101 FontDescriptionChangeScope scope(this); |
102 | 102 |
103 scope.reset(); | 103 scope.reset(); |
104 scope.fontDescription().setUsePrinterFont(m_document->printing()); | |
105 setFontFamilyToStandard(scope.fontDescription(), m_document); | 104 setFontFamilyToStandard(scope.fontDescription(), m_document); |
106 scope.fontDescription().setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1)
; | 105 scope.fontDescription().setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1)
; |
107 setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword
(m_document, CSSValueMedium, false)); | 106 setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword
(m_document, CSSValueMedium, false)); |
108 } | 107 } |
109 | 108 |
110 void FontBuilder::inheritFrom(const FontDescription& fontDescription) | 109 void FontBuilder::inheritFrom(const FontDescription& fontDescription) |
111 { | 110 { |
112 FontDescriptionChangeScope scope(this); | 111 FontDescriptionChangeScope scope(this); |
113 | 112 |
114 scope.set(fontDescription); | 113 scope.set(fontDescription); |
(...skipping 13 matching lines...) Expand all Loading... |
128 | 127 |
129 // Double-check and see if the theme did anything. If not, don't bother upda
ting the font. | 128 // Double-check and see if the theme did anything. If not, don't bother upda
ting the font. |
130 if (!fontDescription.isAbsoluteSize()) | 129 if (!fontDescription.isAbsoluteSize()) |
131 return; | 130 return; |
132 | 131 |
133 // Make sure the rendering mode and printer font settings are updated. | 132 // Make sure the rendering mode and printer font settings are updated. |
134 const Settings* settings = m_document->settings(); | 133 const Settings* settings = m_document->settings(); |
135 ASSERT(settings); // If we're doing style resolution, this document should a
lways be in a frame and thus have settings | 134 ASSERT(settings); // If we're doing style resolution, this document should a
lways be in a frame and thus have settings |
136 if (!settings) | 135 if (!settings) |
137 return; | 136 return; |
138 fontDescription.setUsePrinterFont(m_document->printing()); | |
139 | 137 |
140 // Handle the zoom factor. | 138 // Handle the zoom factor. |
141 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, effectiveZoom, fontDescription.specifiedSize())); | 139 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, effectiveZoom, fontDescription.specifiedSize())); |
142 scope.set(fontDescription); | 140 scope.set(fontDescription); |
143 } | 141 } |
144 | 142 |
145 void FontBuilder::setFontFamilyInitial() | 143 void FontBuilder::setFontFamilyInitial() |
146 { | 144 { |
147 FontDescriptionChangeScope scope(this); | 145 FontDescriptionChangeScope scope(this); |
148 | 146 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 checkForGenericFamilyChange(style, parentStyle); | 646 checkForGenericFamilyChange(style, parentStyle); |
649 checkForOrientationChange(style); | 647 checkForOrientationChange(style); |
650 style->font().update(fontSelector); | 648 style->font().update(fontSelector); |
651 m_fontDirty = false; | 649 m_fontDirty = false; |
652 } | 650 } |
653 | 651 |
654 void FontBuilder::createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector> fon
tSelector, RenderStyle* documentStyle) | 652 void FontBuilder::createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector> fon
tSelector, RenderStyle* documentStyle) |
655 { | 653 { |
656 FontDescription fontDescription = FontDescription(); | 654 FontDescription fontDescription = FontDescription(); |
657 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->
locale())); | 655 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->
locale())); |
658 fontDescription.setUsePrinterFont(m_document->printing()); | |
659 | 656 |
660 setFontFamilyToStandard(fontDescription, m_document); | 657 setFontFamilyToStandard(fontDescription, m_document); |
661 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); | 658 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); |
662 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, false); | 659 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, false); |
663 fontDescription.setSpecifiedSize(size); | 660 fontDescription.setSpecifiedSize(size); |
664 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, documentStyle->effectiveZoom(), size)); | 661 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, documentStyle->effectiveZoom(), size)); |
665 | 662 |
666 FontOrientation fontOrientation; | 663 FontOrientation fontOrientation; |
667 NonCJKGlyphOrientation glyphOrientation; | 664 NonCJKGlyphOrientation glyphOrientation; |
668 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 665 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
669 fontDescription.setOrientation(fontOrientation); | 666 fontDescription.setOrientation(fontOrientation); |
670 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 667 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
671 documentStyle->setFontDescription(fontDescription); | 668 documentStyle->setFontDescription(fontDescription); |
672 documentStyle->font().update(fontSelector); | 669 documentStyle->font().update(fontSelector); |
673 } | 670 } |
674 | 671 |
675 } | 672 } |
OLD | NEW |