Esempio n. 1
0
static PassRef<RenderStyle> createFullScreenStyle()
{
    auto fullscreenStyle = RenderStyle::createDefaultStyle();

    // Create a stacking context:
    fullscreenStyle.get().setZIndex(INT_MAX);

    fullscreenStyle.get().setFontDescription(FontDescription());
    fullscreenStyle.get().font().update(0);

    fullscreenStyle.get().setDisplay(FLEX);
    fullscreenStyle.get().setJustifyContent(JustifyCenter);
    fullscreenStyle.get().setAlignItems(AlignCenter);
    fullscreenStyle.get().setFlexDirection(FlowColumn);
    
    fullscreenStyle.get().setPosition(FixedPosition);
    fullscreenStyle.get().setWidth(Length(100.0, Percent));
    fullscreenStyle.get().setHeight(Length(100.0, Percent));
    fullscreenStyle.get().setLeft(Length(0, WebCore::Fixed));
    fullscreenStyle.get().setTop(Length(0, WebCore::Fixed));
    
    fullscreenStyle.get().setBackgroundColor(Color::black);

    return fullscreenStyle;
}
Esempio n. 2
0
ProgressWindow::ProgressWindow(ContainerWindow &parent)
  :background_color(COLOR_WHITE),
   background_brush(background_color),
   position(0)
{
  PixelRect rc = parent.GetClientRect();
  WindowStyle style;
  style.Hide();
  Create(parent, rc, style);

  const unsigned width = rc.right - rc.left, height = rc.bottom - rc.top;

  // Load progress bar background
  bitmap_progress_border.Load(IDB_PROGRESSBORDER);

  // Determine text height
#ifndef USE_GDI
  font.Load(FontDescription(Layout::FontScale(10)));
  text_height = font.GetHeight();
#else
  VirtualCanvas canvas({1, 1});
  text_height = canvas.GetFontHeight();
#endif

  // Make progress bar height proportional to window height
  const unsigned progress_height = height / 20;
  const unsigned progress_horizontal_border = progress_height / 2;
  progress_border_height = progress_height * 2;

  // Initialize message text field
  PixelRect message_rc = rc;
  message_rc.bottom -= progress_border_height + height / 48;
  message_rc.top = message_rc.bottom - text_height;
  TextWindowStyle message_style;
  message_style.center();
  message.Create(*this, NULL, message_rc, message_style);

#ifndef USE_GDI
  message.SetFont(font);
#endif

  // Initialize progress bar
  PixelRect pb_rc;
  pb_rc.left = progress_horizontal_border;
  pb_rc.right = pb_rc.left + width - progress_height;
  pb_rc.top = height - progress_border_height + progress_horizontal_border;
  pb_rc.bottom = pb_rc.top + progress_height;
  ProgressBarStyle pb_style;
  progress_bar.Create(*this, pb_rc, pb_style);

  message.InstallWndProc(); // needed for OnChildColor()

  // Set progress bar step size and range
  SetRange(0, 1000);
  SetStep(50);

  // Show dialog
  ShowOnTop();
}
Esempio n. 3
0
static void
InitialiseLogFonts(FontSettings &settings)
{
#ifdef WIN32
  if (IsAltair()) {
    LoadAltairLogFonts(settings);
    return;
  }
#endif

  settings.dialog = FontDescription(std::min(Layout::FontScale(12),
                                             Layout::min_screen_pixels / 20));

  settings.infobox = FontDescription(Layout::FontScale(30), true);

  /* the "small" font is derived from the regular font */
  settings.infobox_small = settings.infobox;
  settings.infobox_small.SetHeight(settings.infobox_small.GetHeight() * 4 / 5);
  settings.infobox_small.SetBold(false);

  settings.title = FontDescription(Layout::FontScale(8));

  // new font for CDI Scale
  settings.cdi = FontDescription(Layout::FontScale(10),
                                 false, false, true);

  // new font for map labels
  settings.map_label = FontDescription(Layout::FontScale(8), false, true);

  // new font for map labels big/medium cities
  settings.map_label_important = FontDescription(Layout::FontScale(8),
                                                 true, true);

  // new font for map labels
  settings.map = FontDescription(Layout::FontScale(10));

  // Font for map bold text
  settings.map_bold = FontDescription(Layout::FontScale(10), true);

#ifndef GNAV
  settings.infobox_units = FontDescription(Layout::FontScale(9));
#endif

  settings.monospace = FontDescription(settings.dialog.GetHeight(),
                                       false, false, true);
}
Esempio n. 4
0
void
ChartLook::Initialise()
{
  pens[STYLE_BLUETHIN].Create(Pen::DASH, 2, Color(0, 50, 255));
  pens[STYLE_REDTHICK].Create(Pen::DASH, 3, Color(200, 50, 50));
  pens[STYLE_DASHGREEN].Create(Pen::DASH, 2, COLOR_GREEN);
  pens[STYLE_MEDIUMBLACK].Create(2, Color(50, 243, 45));
  pens[STYLE_THINDASHPAPER].Create(Pen::DASH, 1, Color(0xB0, 0xB0, 0xB0));

  bar_brush.Create(COLOR_GREEN);

  PixelScalar axis_label_size = std::max(8u, Layout::FontScale(6u));
  PixelScalar axis_value_size = std::max(8u, Layout::FontScale(7u));

  label_font.Load(FontDescription(Layout::FontScale(12)));
  axis_label_font.Load(FontDescription(axis_label_size, true));
  axis_value_font.Load(FontDescription(axis_value_size));
}
Esempio n. 5
0
SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
{
    if (!m_smallCapsFontData) {
        FontDescription desc = FontDescription(fontDescription);
        desc.setSpecifiedSize(0.70f * fontDescription.computedSize());
        const FontPlatformData* fontPlatformData = new FontPlatformData(desc, desc.family().family());
        m_smallCapsFontData = new SimpleFontData(*fontPlatformData);
    }
    return m_smallCapsFontData;
}
Esempio n. 6
0
LogoView::LogoView()
  :logo(IDB_LOGO), big_logo(IDB_LOGO_HD),
   title(IDB_TITLE), big_title(IDB_TITLE_HD)
{
#ifndef USE_GDI
  font.Load(FontDescription(Layout::FontScale(10)));
#endif

  big_logo.EnableInterpolation();
  big_title.EnableInterpolation();
}
Esempio n. 7
0
SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
{
    if (!m_smallCapsFontData) {
        FontDescription desc = FontDescription(fontDescription);
        desc.setSpecifiedSize(0.70f * fontDescription.computedSize());
        FontPlatformData pdata(desc, m_font.fontPtr()->GetFamily().c_str());
        
        m_smallCapsFontData = FontCache::getCachedFontData(&pdata);
    }

    return m_smallCapsFontData;
}
Esempio n. 8
0
void FontBuilder::setFontFamilyInitial(float effectiveZoom)
{
    FontDescriptionChangeScope scope(this);

    FontDescription initialDesc = FontDescription();

    // We need to adjust the size to account for the generic family change from monospace to non-monospace.
    if (scope.fontDescription().keywordSize() && scope.fontDescription().useFixedDefaultSize())
        setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword(m_document, CSSValueXxSmall + scope.fontDescription().keywordSize() - 1, false));
    scope.fontDescription().setGenericFamily(initialDesc.genericFamily());
    if (!initialDesc.firstFamily().familyIsEmpty())
        scope.fontDescription().setFamily(initialDesc.firstFamily());
}
Esempio n. 9
0
void FontBuilder::createFontForDocument(FontSelector* fontSelector, ComputedStyle& documentStyle)
{
    FontDescription fontDescription = FontDescription();
    fontDescription.setLocale(documentStyle.locale());

    setFamilyDescription(fontDescription, FontBuilder::initialFamilyDescription());
    setSize(fontDescription, FontDescription::Size(FontSize::initialKeywordSize(), 0.0f, false));
    updateSpecifiedSize(fontDescription, documentStyle);
    updateComputedSize(fontDescription, documentStyle);

    updateOrientation(fontDescription, documentStyle);
    documentStyle.setFontDescription(fontDescription);
    documentStyle.font().update(fontSelector);
}
Esempio n. 10
0
void BrowseFolderMenuItem::init(QString& caption)
{
	QString fontFamily = themeManager->getValueAsFontFamilyName(QT_NT("ui.message.font.family"),QT_NT(""));
	int fontSize = themeManager->getValueAsInt(QT_NT("ui.message.font.size"), 14);
	
	TextOverlay* text = new TextOverlay(caption);
	text->getStyle().setAlpha(1.0f);
	text->setFont(FontDescription(fontFamily, fontSize));
	text->getStyle().setBackgroundColor(ColorVal(0, 0, 0, 0));
	text->getStyle().setPadding(LeftRightEdges, 0.0f);
	text->getStyle().setPadding(TopBottomEdges, 0.0f);

	this->addItem(text);
}
Esempio n. 11
0
void FontBuilder::createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, RenderStyle* documentStyle)
{
    FontDescription fontDescription = FontDescription();
    fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale()));

    setFontFamilyToStandard(fontDescription, m_document);
    fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
    int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, false);
    fontDescription.setSpecifiedSize(size);
    fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescription, documentStyle->effectiveZoom(), size));

    FontOrientation fontOrientation;
    NonCJKGlyphOrientation glyphOrientation;
    getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation);
    fontDescription.setOrientation(fontOrientation);
    fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
    documentStyle->setFontDescription(fontDescription);
    documentStyle->font().update(fontSelector);
}
Esempio n. 12
0
void createFontForDocument(RenderStyle* style)
{
    FontDescription fontDescription = FontDescription();
    fontDescription.setScript(localeToScriptCodeForFontSelection(style->locale()));

    // Using 14px default to match Material Design English Body1:
    // http://www.google.com/design/spec/style/typography.html#typography-typeface
    const float defaultFontSize = 14.0;

    fontDescription.setSpecifiedSize(defaultFontSize);
    fontDescription.setComputedSize(defaultFontSize);

    FontOrientation fontOrientation = Horizontal;
    NonCJKGlyphOrientation glyphOrientation = NonCJKGlyphOrientationVerticalRight;

    fontDescription.setOrientation(fontOrientation);
    fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
    style->setFontDescription(fontDescription);
    style->font().update(UIDartState::Current()->font_selector());
}
Esempio n. 13
0
void LibraryMenuItem::init(QSharedPointer<Library> &library)
{
	_library = library;
	_closeButton = NULL;

	QString fontFamily = themeManager->getValueAsFontFamilyName(QT_NT("ui.message.font.family"),QT_NT(""));
	int fontSize = themeManager->getValueAsInt(QT_NT("ui.message.font.size"), 14);
	
	TextOverlay* text = new TextOverlay(_library->getName());
	text->getStyle().setAlpha(1.0f);
	text->setFont(FontDescription(fontFamily, fontSize));
	text->getStyle().setBackgroundColor(ColorVal(0, 0, 0, 0));
	text->getStyle().setPadding(LeftRightEdges, 0.0f);
	text->getStyle().setPadding(TopBottomEdges, 0.0f);

	float height = (float)text->getTextBuffer().getActualSize().height();
	ImageOverlay* icon = new ImageOverlay(_library->getIconTextureKey());
	icon->getStyle().setScaledDimensions(Vec3(height, height, 0.0f));

	this->addItem(icon);
	this->addItem(text);
}
Esempio n. 14
0
void
InfoBoxLook::ReinitialiseLayout(unsigned width)
{
  FontDescription title_font_d(8);
  AutoSizeFont(title_font_d, width, _T("123456789012345"));
  title_font.Load(title_font_d);

  FontDescription value_font_d(10, true);
  AutoSizeFont(value_font_d, width, _T("1234m"));
  value_font.Load(value_font_d);

  FontDescription small_value_font_d(10);
  AutoSizeFont(small_value_font_d, width, _T("12345m"));
  small_value_font.Load(small_value_font_d);

  unsigned unit_font_height = std::max(value_font_d.GetHeight() * 2u / 5u, 7u);
  unit_font.Load(FontDescription(unit_font_height));

#ifdef HAVE_TEXT_CACHE
  TextCache::Flush();
#endif
}
Esempio n. 15
0
void
VarioLook::Initialise(bool _inverse, bool _colors,
                      const Font &_text_font)
{
  inverse = _inverse;
  colors = _colors;

  if (inverse) {
    background_color = COLOR_BLACK;
    text_color = COLOR_WHITE;
    dimmed_text_color = Color(0xa0, 0xa0, 0xa0);
    sink_color = Color(0xc4, 0x80, 0x1e);
    lift_color = Color(0x1e, 0xf1, 0x73);
  } else {
    background_color = COLOR_WHITE;
    text_color = COLOR_BLACK;
    dimmed_text_color = Color((uint8_t)~0xa0, (uint8_t)~0xa0, (uint8_t)~0xa0);
    sink_color = Color(0xa3,0x69,0x0d);
    lift_color = Color(0x19,0x94,0x03);
  }

  sink_brush.Create(sink_color);
  lift_brush.Create(lift_color);

  thick_background_pen.Create(Layout::Scale(5), background_color);
  thick_sink_pen.Create(Layout::Scale(5), sink_color);
  thick_lift_pen.Create(Layout::Scale(5), lift_color);

  background_bitmap.Load(Units::GetUserVerticalSpeedUnit() == Unit::KNOTS
                         ? IDB_VARIOSCALEC : IDB_VARIOSCALEA);
  background_x = inverse ? 58 : 0;

  climb_bitmap.Load(inverse ? IDB_CLIMBSMALLINV : IDB_CLIMBSMALL);

  text_font = &_text_font;

  value_font.Load(FontDescription(Layout::FontScale(10), false, false, true));
}
Esempio n. 16
0
static void
LoadAltairLogFonts(FontSettings &settings)
{
  settings.dialog = FontDescription(_T("RasterGothicTwelveCond"), 13);
#ifdef GNAV
  settings.dialog_small = FontDescription(_T("RasterGothicNineCond"), 10);
#endif
  settings.infobox = FontDescription(_T("RasterGothicTwentyFourCond"),
                                     24, true);
  settings.title = FontDescription(_T("RasterGothicNineCond"), 10);
  settings.cdi = FontDescription(_T("RasterGothicEighteenCond"), 19, true);
  settings.map_label = FontDescription(_T("RasterGothicTwelveCond"), 13);
  settings.map_label_important = FontDescription(_T("RasterGothicTwelveCond"),
                                                 13);
  settings.map = FontDescription(_T("RasterGothicFourteenCond"), 15);
  settings.map_bold = FontDescription(_T("RasterGothicFourteenCond"),
                                      15, true);
  settings.infobox_small = FontDescription(_T("RasterGothicEighteenCond"),
                                           19, true);
  settings.monospace = FontDescription(GetStandardMonospaceFontFace(),
                                       12, false, false, true);
}
Esempio n. 17
0
// static
void RenderThemeChromiumWin::setDefaultFontSize(int fontSize) {
    defaultFontSize = static_cast<float>(fontSize);

    // Reset cached fonts.
    smallSystemFont = menuFont = labelFont = FontDescription();
}
Esempio n. 18
0
 constexpr FontDescription WithBold(bool _bold=true) const {
   return FontDescription(height, _bold, italic, monospace);
 }
Esempio n. 19
0
 void reset() { m_fontDescription = FontDescription(); }
Esempio n. 20
0
void
InitialiseFonts()
{
  normal_font.Load(FontDescription(Layout::FontScale(12)));
  bold_font.Load(FontDescription(Layout::FontScale(12), true));
}
Esempio n. 21
0
 constexpr FontDescription WithHeight(unsigned _height) const {
   return FontDescription(_height, bold, italic, monospace);
 }