本文整理汇总了C++中FontDescription::isAbsoluteSize方法的典型用法代码示例。如果您正苦于以下问题:C++ FontDescription::isAbsoluteSize方法的具体用法?C++ FontDescription::isAbsoluteSize怎么用?C++ FontDescription::isAbsoluteSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontDescription
的用法示例。
在下文中一共展示了FontDescription::isAbsoluteSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: systemFont
void RenderThemeChromiumWin::systemFont(int propId, FontDescription& fontDescription) const
{
// This logic owes much to RenderThemeSafari.cpp.
FontDescription* cachedDesc = 0;
AtomicString faceName;
float fontSize = 0;
switch (propId) {
case CSSValueSmallCaption:
cachedDesc = &smallSystemFont;
if (!smallSystemFont.isAbsoluteSize()) {
NONCLIENTMETRICS metrics;
getNonClientMetrics(&metrics);
faceName = AtomicString(metrics.lfSmCaptionFont.lfFaceName, wcslen(metrics.lfSmCaptionFont.lfFaceName));
fontSize = systemFontSize(metrics.lfSmCaptionFont);
}
break;
case CSSValueMenu:
cachedDesc = &menuFont;
if (!menuFont.isAbsoluteSize()) {
NONCLIENTMETRICS metrics;
getNonClientMetrics(&metrics);
faceName = AtomicString(metrics.lfMenuFont.lfFaceName, wcslen(metrics.lfMenuFont.lfFaceName));
fontSize = systemFontSize(metrics.lfMenuFont);
}
break;
case CSSValueStatusBar:
cachedDesc = &labelFont;
if (!labelFont.isAbsoluteSize()) {
NONCLIENTMETRICS metrics;
getNonClientMetrics(&metrics);
faceName = metrics.lfStatusFont.lfFaceName;
fontSize = systemFontSize(metrics.lfStatusFont);
}
break;
case CSSValueWebkitMiniControl:
case CSSValueWebkitSmallControl:
case CSSValueWebkitControl:
faceName = defaultGUIFont();
// Why 2 points smaller? Because that's what Gecko does.
fontSize = defaultFontSize - pointsToPixels(2);
break;
default:
faceName = defaultGUIFont();
fontSize = defaultFontSize;
break;
}
if (!cachedDesc)
cachedDesc = &fontDescription;
if (fontSize) {
cachedDesc->firstFamily().setFamily(faceName);
cachedDesc->setIsAbsoluteSize(true);
cachedDesc->setGenericFamily(FontDescription::NoFamily);
cachedDesc->setSpecifiedSize(fontSize);
cachedDesc->setWeight(FontWeightNormal);
cachedDesc->setItalic(false);
}
fontDescription = *cachedDesc;
}
示例2: checkForGenericFamilyChange
void FontBuilder::checkForGenericFamilyChange(const FontDescription& oldDescription, FontDescription& newDescription)
{
if (newDescription.isAbsoluteSize())
return;
if (newDescription.isMonospace() == oldDescription.isMonospace())
return;
// For now, lump all families but monospace together.
if (newDescription.genericFamily() != FontDescription::MonospaceFamily
&& oldDescription.genericFamily() != FontDescription::MonospaceFamily)
return;
// We know the parent is monospace or the child is monospace, and that font
// size was unspecified. We want to scale our font size as appropriate.
// If the font uses a keyword size, then we refetch from the table rather than
// multiplying by our scale factor.
float size;
if (newDescription.keywordSize()) {
size = FontSize::fontSizeForKeyword(&m_document, newDescription.keywordSize(), newDescription.isMonospace());
} else {
Settings* settings = m_document.settings();
float fixedScaleFactor = (settings && settings->defaultFixedFontSize() && settings->defaultFontSize())
? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
: 1;
size = oldDescription.isMonospace() ?
newDescription.specifiedSize() / fixedScaleFactor :
newDescription.specifiedSize() * fixedScaleFactor;
}
newDescription.setSpecifiedSize(size);
}
示例3: systemFont
void RenderTheme::systemFont(CSSValueID systemFontID, FontDescription& fontDescription) const
{
fontDescription = cachedSystemFontDescription(systemFontID);
if (fontDescription.isAbsoluteSize())
return;
updateCachedSystemFontDescription(systemFontID, fontDescription);
}
示例4: getComputedSizeFromSpecifiedSize
float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescription, float effectiveZoom, float specifiedSize)
{
float zoomFactor = effectiveZoom;
// FIXME: Why is this here!!!!?!
if (LocalFrame* frame = m_document->frame())
zoomFactor *= frame->textZoomFactor();
return FontSize::getComputedSizeFromSpecifiedSize(m_document, zoomFactor, fontDescription.isAbsoluteSize(), specifiedSize);
}
示例5: systemFont
void RenderThemeSafari::systemFont(int propId, FontDescription& fontDescription) const
{
static FontDescription systemFont;
static FontDescription smallSystemFont;
static FontDescription menuFont;
static FontDescription labelFont;
static FontDescription miniControlFont;
static FontDescription smallControlFont;
static FontDescription controlFont;
FontDescription* cachedDesc;
float fontSize = 0;
switch (propId) {
case CSSValueSmallCaption:
cachedDesc = &smallSystemFont;
if (!smallSystemFont.isAbsoluteSize())
fontSize = systemFontSizeForControlSize(NSSmallControlSize);
break;
case CSSValueMenu:
cachedDesc = &menuFont;
if (!menuFont.isAbsoluteSize())
fontSize = systemFontSizeForControlSize(NSRegularControlSize);
break;
case CSSValueStatusBar:
cachedDesc = &labelFont;
if (!labelFont.isAbsoluteSize())
fontSize = 10.0f;
break;
case CSSValueWebkitMiniControl:
cachedDesc = &miniControlFont;
if (!miniControlFont.isAbsoluteSize())
fontSize = systemFontSizeForControlSize(NSMiniControlSize);
break;
case CSSValueWebkitSmallControl:
cachedDesc = &smallControlFont;
if (!smallControlFont.isAbsoluteSize())
fontSize = systemFontSizeForControlSize(NSSmallControlSize);
break;
case CSSValueWebkitControl:
cachedDesc = &controlFont;
if (!controlFont.isAbsoluteSize())
fontSize = systemFontSizeForControlSize(NSRegularControlSize);
break;
default:
cachedDesc = &systemFont;
if (!systemFont.isAbsoluteSize())
fontSize = 13.0f;
}
if (fontSize) {
cachedDesc->setIsAbsoluteSize(true);
cachedDesc->setGenericFamily(FontDescription::NoFamily);
cachedDesc->firstFamily().setFamily("Lucida Grande");
cachedDesc->setSpecifiedSize(fontSize);
cachedDesc->setWeight(FontWeightNormal);
cachedDesc->setItalic(false);
}
fontDescription = *cachedDesc;
}
示例6: fromSystemFont
void FontBuilder::fromSystemFont(CSSValueID valueId, float effectiveZoom)
{
FontDescriptionChangeScope scope(this);
FontDescription fontDescription;
RenderTheme::theme().systemFont(valueId, fontDescription);
// Double-check and see if the theme did anything. If not, don't bother updating the font.
if (!fontDescription.isAbsoluteSize())
return;
// Make sure the rendering mode and printer font settings are updated.
const Settings* settings = m_document->settings();
ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
if (!settings)
return;
// Handle the zoom factor.
fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescription, effectiveZoom, fontDescription.specifiedSize()));
scope.set(fontDescription);
}
示例7: resolveForDocument
PassRef<RenderStyle> resolveForDocument(const Document& document)
{
ASSERT(document.hasLivingRenderTree());
RenderView& renderView = *document.renderView();
// HTML5 states that seamless iframes should replace default CSS values
// with values inherited from the containing iframe element. However,
// some values (such as the case of designMode = "on") still need to
// be set by this "document style".
auto documentStyle = RenderStyle::create();
bool seamlessWithParent = document.shouldDisplaySeamlesslyWithParent();
if (seamlessWithParent) {
RenderStyle* iframeStyle = document.seamlessParentIFrame()->renderStyle();
if (iframeStyle)
documentStyle.get().inheritFrom(iframeStyle);
}
// FIXME: It's not clear which values below we want to override in the seamless case!
documentStyle.get().setDisplay(BLOCK);
if (!seamlessWithParent) {
documentStyle.get().setRTLOrdering(document.visuallyOrdered() ? VisualOrder : LogicalOrder);
documentStyle.get().setZoom(!document.printing() ? renderView.frame().pageZoomFactor() : 1);
documentStyle.get().setPageScaleTransform(renderView.frame().frameScaleFactor());
documentStyle.get().setLocale(document.contentLanguage());
}
// This overrides any -webkit-user-modify inherited from the parent iframe.
documentStyle.get().setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONLY);
Element* docElement = document.documentElement();
RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0;
if (docElementRenderer) {
// Use the direction and writing-mode of the body to set the
// viewport's direction and writing-mode unless the property is set on the document element.
// If there is no body, then use the document element.
RenderObject* bodyRenderer = document.body() ? document.body()->renderer() : 0;
if (bodyRenderer && !document.writingModeSetOnDocumentElement())
documentStyle.get().setWritingMode(bodyRenderer->style()->writingMode());
else
documentStyle.get().setWritingMode(docElementRenderer->style()->writingMode());
if (bodyRenderer && !document.directionSetOnDocumentElement())
documentStyle.get().setDirection(bodyRenderer->style()->direction());
else
documentStyle.get().setDirection(docElementRenderer->style()->direction());
}
const Pagination& pagination = renderView.frameView().pagination();
if (pagination.mode != Pagination::Unpaginated) {
documentStyle.get().setColumnStylesFromPaginationMode(pagination.mode);
documentStyle.get().setColumnGap(pagination.gap);
if (renderView.hasColumns())
renderView.updateColumnInfoFromStyle(&documentStyle.get());
}
// Seamless iframes want to inherit their font from their parent iframe, so early return before setting the font.
if (seamlessWithParent)
return documentStyle;
const Settings& settings = renderView.frame().settings();
FontDescription fontDescription;
fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle.get().locale()));
fontDescription.setUsePrinterFont(document.printing() || !settings.screenFontSubstitutionEnabled());
fontDescription.setRenderingMode(settings.fontRenderingMode());
const AtomicString& standardFont = settings.standardFontFamily(fontDescription.script());
if (!standardFont.isEmpty()) {
fontDescription.setGenericFamily(FontDescription::StandardFamily);
fontDescription.setOneFamily(standardFont);
}
fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
int size = fontSizeForKeyword(CSSValueMedium, false, document);
fontDescription.setSpecifiedSize(size);
bool useSVGZoomRules = document.isSVGDocument();
fontDescription.setComputedSize(computedFontSizeFromSpecifiedSize(size, fontDescription.isAbsoluteSize(), useSVGZoomRules, &documentStyle.get(), document));
FontOrientation fontOrientation;
NonCJKGlyphOrientation glyphOrientation;
documentStyle.get().getFontAndGlyphOrientation(fontOrientation, glyphOrientation);
fontDescription.setOrientation(fontOrientation);
fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
documentStyle.get().setFontDescription(fontDescription);
CSSFontSelector* fontSelector = document.styleResolverIfExists() ? document.styleResolverIfExists()->fontSelector() : 0;
documentStyle.get().font().update(fontSelector);
return documentStyle;
}