| 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/css/resolver/FontBuilder.h" | 24 #include "core/css/resolver/FontBuilder.h" |
| 25 | 25 |
| 26 #include "core/css/CSSCalculationValue.h" | 26 #include "core/css/CSSCalculationValue.h" |
| 27 #include "core/css/CSSFontFeatureValue.h" | |
| 28 #include "core/css/CSSToLengthConversionData.h" | 27 #include "core/css/CSSToLengthConversionData.h" |
| 29 #include "core/css/FontSize.h" | 28 #include "core/css/FontSize.h" |
| 30 #include "core/frame/LocalFrame.h" | 29 #include "core/frame/LocalFrame.h" |
| 31 #include "core/frame/Settings.h" | 30 #include "core/frame/Settings.h" |
| 32 #include "core/rendering/RenderTheme.h" | 31 #include "core/rendering/RenderTheme.h" |
| 33 #include "core/rendering/RenderView.h" | 32 #include "core/rendering/RenderView.h" |
| 34 #include "platform/fonts/FontDescription.h" | 33 #include "platform/fonts/FontDescription.h" |
| 35 #include "platform/text/LocaleToScriptMapping.h" | 34 #include "platform/text/LocaleToScriptMapping.h" |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 scope.fontDescription().setKerning(kerning); | 409 scope.fontDescription().setKerning(kerning); |
| 411 } | 410 } |
| 412 | 411 |
| 413 void FontBuilder::setFontSmoothing(FontSmoothingMode foontSmoothingMode) | 412 void FontBuilder::setFontSmoothing(FontSmoothingMode foontSmoothingMode) |
| 414 { | 413 { |
| 415 FontDescriptionChangeScope scope(this); | 414 FontDescriptionChangeScope scope(this); |
| 416 | 415 |
| 417 scope.fontDescription().setFontSmoothing(foontSmoothingMode); | 416 scope.fontDescription().setFontSmoothing(foontSmoothingMode); |
| 418 } | 417 } |
| 419 | 418 |
| 420 void FontBuilder::setFeatureSettingsNormal() | 419 void FontBuilder::setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) |
| 421 { | 420 { |
| 422 FontDescriptionChangeScope scope(this); | 421 FontDescriptionChangeScope scope(this); |
| 423 | 422 |
| 424 // FIXME: Eliminate FontDescription::makeNormalFeatureSettings. It's useless
. | 423 scope.fontDescription().setFeatureSettings(settings); |
| 425 scope.set(scope.fontDescription().makeNormalFeatureSettings()); | |
| 426 } | |
| 427 | |
| 428 void FontBuilder::setFeatureSettingsValue(CSSValue* value) | |
| 429 { | |
| 430 FontDescriptionChangeScope scope(this); | |
| 431 | |
| 432 CSSValueList* list = toCSSValueList(value); | |
| 433 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); | |
| 434 int len = list->length(); | |
| 435 for (int i = 0; i < len; ++i) { | |
| 436 CSSValue* item = list->item(i); | |
| 437 if (!item->isFontFeatureValue()) | |
| 438 continue; | |
| 439 CSSFontFeatureValue* feature = toCSSFontFeatureValue(item); | |
| 440 settings->append(FontFeature(feature->tag(), feature->value())); | |
| 441 } | |
| 442 scope.fontDescription().setFeatureSettings(settings.release()); | |
| 443 } | 424 } |
| 444 | 425 |
| 445 void FontBuilder::setSize(FontDescription& fontDescription, float effectiveZoom,
float size) | 426 void FontBuilder::setSize(FontDescription& fontDescription, float effectiveZoom,
float size) |
| 446 { | 427 { |
| 447 fontDescription.setSpecifiedSize(size); | 428 fontDescription.setSpecifiedSize(size); |
| 448 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, effectiveZoom, size)); | 429 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, effectiveZoom, size)); |
| 449 } | 430 } |
| 450 | 431 |
| 451 float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescrip
tion, float effectiveZoom, float specifiedSize) | 432 float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescrip
tion, float effectiveZoom, float specifiedSize) |
| 452 { | 433 { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 FontOrientation fontOrientation; | 563 FontOrientation fontOrientation; |
| 583 NonCJKGlyphOrientation glyphOrientation; | 564 NonCJKGlyphOrientation glyphOrientation; |
| 584 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 565 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
| 585 fontDescription.setOrientation(fontOrientation); | 566 fontDescription.setOrientation(fontOrientation); |
| 586 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 567 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
| 587 documentStyle->setFontDescription(fontDescription); | 568 documentStyle->setFontDescription(fontDescription); |
| 588 documentStyle->font().update(fontSelector); | 569 documentStyle->font().update(fontSelector); |
| 589 } | 570 } |
| 590 | 571 |
| 591 } | 572 } |
| OLD | NEW |