646 void FontBuilder::createFontForDocument(PassRefPtr<FontSelector> fontSelector, RenderStyle* documentStyle)
647 {
648 FontDescription fontDescription = FontDescription();
649 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale()));
650 if (Settings* settings = m_document->settings()) {
651 fontDescription.setUsePrinterFont(m_document->printing());
652 const AtomicString& standardFont = settings->standardFontFamily(fontDescription.script());
653 if (!standardFont.isEmpty()) {
654 fontDescription.setGenericFamily(FontDescription::StandardFamily);
655 fontDescription.firstFamily().setFamily(standardFont);
656 fontDescription.firstFamily().appendFamily(0);
657 }
658 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
659 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, false);
660 fontDescription.setSpecifiedSize(size);
661 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescription, documentStyle->effectiveZoom(), size));
662 } else {
663 fontDescription.setUsePrinterFont(m_document->printing());
664 }
665
666 FontOrientation fontOrientation;
667 NonCJKGlyphOrientation glyphOrientation;
668 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation);
669 fontDescription.setOrientation(fontOrientation);
670 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
671 documentStyle->setFontDescription(fontDescription);
672 documentStyle->font().update(fontSelector);
673 }
1155 bool RenderStyle::setFontDescription(const FontDescription& v)
1156 {
1157 if (inherited->font.fontDescription() != v) {
1158 inherited.access()->font =
Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
1159 return true;
1160 }
1161 return false;
1162 }