void KexiTitleLabel::changeEvent(QEvent* event) { QLabel::changeEvent(event); if (event->type() == QEvent::FontChange) { updateFont(); } }
void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask) { inheritedFontResolveMask = inheritedMask; QFont naturalFont = naturalWidgetFont(); QFont resolvedFont = font.resolve(naturalFont); updateFont(resolvedFont); }
void QgsLabelingGui::on_mFontSizeSpinBox_valueChanged( double d ) { QFont font = lblFontPreview->font(); font.setPointSizeF( d ); lblFontPreview->setFont( font ); updateFont( font ); }
void setTextFont(const char *pfn) { size_t len; ACL_ASSERT_BEGIN_PAINT; len = strlen(pfn); strcpy(g_fontName, pfn); updateFont(); }
void OverlayTextDisplay::updateOvertakeColorProperties() { if (!overtake_color_properties_ && overtake_color_properties_property_->getBool()) { // read all the parameters from properties updateFGColor(); updateFGAlpha(); updateBGColor(); updateBGAlpha(); updateFont(); updateLineWidth(); require_update_texture_ = true; } overtake_color_properties_ = overtake_color_properties_property_->getBool(); if (overtake_color_properties_) { fg_color_property_->show(); fg_alpha_property_->show(); bg_color_property_->show(); bg_alpha_property_->show(); line_width_property_->show(); font_property_->show(); } else { fg_color_property_->hide(); fg_alpha_property_->hide(); bg_color_property_->hide(); bg_alpha_property_->hide(); line_width_property_->hide(); font_property_->hide(); } }
void SkPDFDevice::drawPosText(const SkDraw&, const void* text, size_t len, const SkScalar pos[], SkScalar constY, int scalarsPerPos, const SkPaint& paint) { SkASSERT(1 == scalarsPerPos || 2 == scalarsPerPos); SkPaint textPaint = calculateTextPaint(paint); updateGSFromPaint(textPaint, true); // Make sure we have a glyph id encoding. SkAutoFree glyphStorage; uint16_t* glyphIDs; size_t numGlyphs; if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) { numGlyphs = paint.textToGlyphs(text, len, NULL); glyphIDs = (uint16_t*)sk_malloc_flags(numGlyphs * 2, SK_MALLOC_TEMP | SK_MALLOC_THROW); glyphStorage.set(glyphIDs); paint.textToGlyphs(text, len, glyphIDs); textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); } else { SkASSERT((len & 1) == 0); numGlyphs = len / 2; glyphIDs = (uint16_t*)text; } SkDrawCacheProc glyphCacheProc = textPaint.getDrawCacheProc(); fContent.writeText("BT\n"); updateFont(textPaint, glyphIDs[0]); for (size_t i = 0; i < numGlyphs; i++) { SkPDFFont* font = fGraphicStack[fGraphicStackIndex].fFont; uint16_t encodedValue = glyphIDs[i]; if (font->glyphsToPDFFontEncoding(&encodedValue, 1) != 1) { updateFont(textPaint, glyphIDs[i]); i--; continue; } SkScalar x = pos[i * scalarsPerPos]; SkScalar y = scalarsPerPos == 1 ? constY : pos[i * scalarsPerPos + 1]; alignText(glyphCacheProc, textPaint, glyphIDs + i, 1, &x, &y, NULL); setTextTransform(x, y, textPaint.getTextSkewX()); SkString encodedString = SkPDFString::formatString(&encodedValue, 1, font->multiByteGlyphs()); fContent.writeText(encodedString.c_str()); fContent.writeText(" Tj\n"); } fContent.writeText("ET\n"); }
/************************************************************************* Notify the Font of the current (usually new) display resolution. *************************************************************************/ void Font::notifyScreenResolution (const Size& size) { d_horzScaling = size.d_width / d_nativeHorzRes; d_vertScaling = size.d_height / d_nativeVertRes; if (d_autoScale) updateFont (); }
void MSWidget::font(Font font_) { if (font_!=font()) { Font old=font(); _fontID=font_; updateFont(old); } }
void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) { if (! _visible || _originalUTF8String.empty()) { return; } if (_systemFontDirty) { updateFont(); } if (_contentDirty) { updateContent(); } uint32_t flags = processParentFlags(parentTransform, parentFlags); if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || (flags & FLAGS_DIRTY_MASK))) { _position.x += _shadowOffset.width; _position.y += _shadowOffset.height; _transformDirty = _inverseDirty = true; _shadowTransform = transform(parentTransform); _position.x -= _shadowOffset.width; _position.y -= _shadowOffset.height; _transformDirty = _inverseDirty = true; _shadowDirty = false; } // IMPORTANT: // To ease the migration to v3.0, we still support the Mat4 stack, // but it is deprecated and your code should not rely on it Director* director = Director::getInstance(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); if (_textSprite) { drawTextSprite(renderer, flags); } else { draw(renderer, _modelViewTransform, flags); } director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); // FIX ME: Why need to set _orderOfArrival to 0?? // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920 // setOrderOfArrival(0); }
void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) { if (! _visible || _originalUTF8String.empty()) { return; } if (_fontDirty) { updateFont(); } if (_contentDirty) { updateContent(); } bool dirty = parentTransformUpdated || _transformUpdated; if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || dirty)) { _position.x += _shadowOffset.width; _position.y += _shadowOffset.height; _transformDirty = _inverseDirty = true; _shadowTransform = transform(parentTransform); _position.x -= _shadowOffset.width; _position.y -= _shadowOffset.height; _transformDirty = _inverseDirty = true; _shadowDirty = false; } if(dirty) { _modelViewTransform = transform(parentTransform); } _transformUpdated = false; // IMPORTANT: // To ease the migration to v3.0, we still support the kmGL stack, // but it is deprecated and your code should not rely on it kmGLPushMatrix(); kmGLLoadMatrix(&_modelViewTransform); if (_textSprite) { drawTextSprite(renderer,dirty); } else { draw(renderer, _modelViewTransform, dirty); } kmGLPopMatrix(); setOrderOfArrival(0); }
void nextFont() { number++; if (number >= fontNames.size()) number = fontNames.size() - 1; updateFont(); }
void TrackView::paintEvent(QPaintEvent *event) { QStylePainter painter(this->viewport()); updateFont(painter.fontMetrics()); // HACK: the fontMetrics we get from QWidget is not scaled properly paintTopMargin(painter, event->region()); paintLeftMargin(painter, event->region()); paintTracks(painter, event->region()); }
void KopeteRichTextEditPart::setFont( const QString &newFont ) { mFont.setFamily( newFont ); if( m_capabilities & Kopete::Protocol::RichFont) editor->setFamily( newFont ); else if( m_capabilities & Kopete::Protocol::BaseFont) editor->setFont( mFont ); updateFont(); writeConfig(); }
void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask) { Q_Q(QGraphicsWidget); inheritedFontResolveMask = inheritedMask; if (QGraphicsWidget *p = q->parentWidget()) inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask; QFont naturalFont = naturalWidgetFont(); QFont resolvedFont = font.resolve(naturalFont); updateFont(resolvedFont); }
TrackView::TrackView(SyncPage *page, QWidget *parent) : QAbstractScrollArea(parent), page(page), windowRows(0), readOnly(false), dragging(false) { Q_ASSERT(page); lineEdit = new QLineEdit(this); lineEdit->setAutoFillBackground(true); lineEdit->hide(); QDoubleValidator *lineEditValidator = new QDoubleValidator(); lineEditValidator->setNotation(QDoubleValidator::StandardNotation); lineEditValidator->setLocale(QLocale::c()); lineEdit->setValidator(lineEditValidator); QObject::connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(onEditingFinished())); viewport()->setAutoFillBackground(false); setFocus(Qt::OtherFocusReason); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); scrollPosX = 0; scrollPosY = 0; editRow = 0; editTrack = 0; selectionStart = selectionEnd = QPoint(0, 0); updateFont(fontMetrics()); updatePalette(); stepPen = QPen(); lerpPen = QPen(QBrush(Qt::red), 2); smoothPen = QPen(QBrush(Qt::green), 2); rampPen = QPen(QBrush(Qt::blue), 2); editBrush = Qt::yellow; bookmarkBrush = QColor(128, 128, 255); handCursor = QCursor(Qt::OpenHandCursor); setMouseTracking(true); setupScrollBars(); QObject::connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onHScroll(int))); QObject::connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onVScroll(int))); QObject::connect(page, SIGNAL(trackHeaderChanged(int)), this, SLOT(onTrackHeaderChanged(int))); QObject::connect(page, SIGNAL(trackDataChanged(int, int, int)), this, SLOT(onTrackDataChanged(int, int, int))); }
//Easy Font setting contributed from Colin Duffy ([email protected]) bool ofxUICanvas::loadFont(string filename, bool _bAntiAliased, bool _bFullCharacterSet, bool makeContours, float simplifyAmt, int dpi) { bool large = updateFont(OFX_UI_FONT_LARGE, filename, OFX_UI_FONT_LARGE_SIZE, _bAntiAliased, _bFullCharacterSet, makeContours, simplifyAmt, dpi); bool medium = updateFont(OFX_UI_FONT_MEDIUM, filename, OFX_UI_FONT_MEDIUM_SIZE, _bAntiAliased, _bFullCharacterSet, makeContours, simplifyAmt, dpi); bool small = updateFont(OFX_UI_FONT_SMALL, filename, OFX_UI_FONT_SMALL_SIZE, _bAntiAliased, _bFullCharacterSet, makeContours, simplifyAmt, dpi); bool successful = large && medium && small; if( successful ) fontName = filename; return successful; }
//----------------------------------------------------------------------------// void Font::setAutoScaled(const AutoScaledMode auto_scaled) { if (auto_scaled == d_autoScaled) return; d_autoScaled = auto_scaled; updateFont(); FontEventArgs args(this); onRenderSizeChanged(args); }
void QJsonPaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) { Q_D(QJsonPaintEngine); #ifdef QT_PICTURE_DEBUG qDebug() << " -> drawTextItem():" << p << ti.text(); #endif updateFont(ti.font()); d->s << QString("\t{\"t\": {\"t\": \"%1\", \"x\": %2, \"y\": %3}},\r\n").arg(ti.text()).arg(p.x()).arg(p.y()); }
void FontTryControl::OnInitialise(Control* _parent, MyGUI::Widget* _place, const std::string& _layoutName) { Control::OnInitialise(_parent, _place, _layoutName); mEdit = mMainWidget->castType<MyGUI::EditBox>(); mEdit->setCaption(SettingsManager::getInstance().getValue("Controls/TryFontControl/Text")); CommandManager::getInstance().getEvent("Command_OnGenerateFont")->connect(this, &FontTryControl::commandOnGenerateFont); DataSelectorManager::getInstance().getEvent("Root")->connect(this, &FontTryControl::notifyChangeDataSelector); updateFont(); }
void MSTextRect::font(Font fid_) { if (fid_!=0&&fid_!=font()) { Font oldfid=_fid; _fid=fid_; textMSGC().font(fid_); _textFontStruct=(XFontStruct *)server()->fontStruct(font()); computeSize(); updateFont(oldfid); } }
void MainWindow::updateEditButtonsState() { editingEnabled = JS("isOnEditableArea();").toBool(); emit editButtonsStateChanged(editingEnabled); if (editingEnabled) { QString f = JS("document.queryCommandValue('fontName');").toString(); emit updateFont(QFont(f)); int size = JS("document.queryCommandValue('fontSize');").toInt(); emit updateFontSize(size - 1); } }
void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult) { const Element* element = state.element(); ASSERT(element); INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply); unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; bool applyInheritedOnly = false; const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_matchedPropertiesCache.find(cacheHash, state, matchResult) : 0; if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(element, state.style(), state.parentStyle())) { INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit); // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the // element context. This is fast and saves memory by reusing the style data structures. state.style()->copyNonInheritedFrom(cachedMatchedProperties->renderStyle.get()); if (state.parentStyle()->inheritedDataShared(cachedMatchedProperties->parentRenderStyle.get()) && (state.style()->userModify() == READ_ONLY)) { INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHit); // If the cache item parent style has identical inherited properties to the current parent style then the // resulting style will be identical too. We copy the inherited properties over from the cache and are done. state.style()->inheritFrom(cachedMatchedProperties->renderStyle.get()); return; } applyInheritedOnly = true; } state.setLineHeightValue(0); applyMatchedProperties<HighPriorityProperties>(state, matchResult, applyInheritedOnly); // If our font got dirtied, go ahead and update it now. updateFont(state); // Line-height is set when we are sure we decided on the font-size. if (state.lineHeightValue()) StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeightValue()); // Many properties depend on the font. If it changes we just apply all properties. if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDescription() != state.style()->fontDescription()) applyInheritedOnly = false; applyMatchedProperties<LowPriorityProperties>(state, matchResult, applyInheritedOnly); if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCacheable(element, state.style(), state.parentStyle())) { INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHash, matchResult); } ASSERT(!state.fontBuilder().fontDirty()); }
//----------------------------------------------------------------------------// void Font::notifyDisplaySizeChanged(const Sizef& size) { Image::computeScalingFactors(d_autoScaled, size, d_nativeResolution, d_horzScaling, d_vertScaling); if (d_autoScaled != ASM_Disabled) { updateFont(); FontEventArgs args(this); onRenderSizeChanged(args); } }
TextObject::TextObject(SDL_Renderer* r, const string& text, int fontSize, const Point& p) { this->renderer = r; cout << "TextObject Renderer: " << this->renderer << endl; this->fontLocation = DEFAULT_FONT_LOCATION; this->fontSize = fontSize; this->p = p; this->text = text; texture = nullptr; updateFont(); createTextTexture(); }
//! Change back to the old state void restoreState(GfxState *state) { g_print ("restoreState\n"); // should contain all of our update*() methods? updateLineWidth(state); updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateStrokeColor(state); updateStrokeOpacity(state); updateFillColor(state); updateFillOpacity(state); updateFont(state); }
//----------------------------------------------------------------------------// PixmapFont::PixmapFont(const String& font_name, const String& imageset_filename, const String& resource_group, const AutoScaledMode auto_scaled, const Sizef& native_res): Font(font_name, Font_xmlHandler::FontTypePixmap, imageset_filename, resource_group, auto_scaled, native_res), d_origHorzScaling(1.0f), d_imagesetOwner(false) { addPixmapFontProperties(); reinit(); updateFont(); }
void TrackView::changeEvent(QEvent *event) { switch (event->type()) { case QEvent::FontChange: updateFont(fontMetrics()); update(); break; case QEvent::PaletteChange: updatePalette(); break; default: ; } }
void QgsLabelingGui::changeTextFont() { bool ok; #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon QFont font = QFontDialog::getFont( &ok, mRefFont, 0, QString(), QFontDialog::DontUseNativeDialog ); #else QFont font = QFontDialog::getFont( &ok, mRefFont ); #endif if ( ok ) { updateFont( font ); } mFontSizeSpinBox->setValue( mRefFont.pointSizeF() ); }
void fileClicked(const File & newFile, const MouseEvent &) override { MemoryBlock mb; bool success = newFile.loadFileAsData(mb); if (!success) return; if (!(newFile.hasFileExtension("ttf") || newFile.hasFileExtension("otf"))) return; newTypeface = Typeface::createSystemTypefaceFor(mb.getData(), mb.getSize()); updateFont(newTypeface); }
void beginPaint() { HDC hdc; ACL_ASSERT_HWND; hdc = GetDC(g_hWnd); g_hmemdc = CreateCompatibleDC(hdc); SelectObject(g_hmemdc, g_HBITMAP); updatePen(); updateBrush(); updateFont(); setTextColor(g_textColor); setTextBkColor(g_textBkColor); }