Example #1
0
/*
 *  Private font initialisation function.
 */
PROTECTED
void init_fonts(void)
{
	HDC info;

	/* get system information */
	info = CreateIC("DISPLAY", NULL, NULL, NULL);
	screen_dpix = GetDeviceCaps(info, LOGPIXELSX);
	screen_dpiy = GetDeviceCaps(info, LOGPIXELSY);
	DeleteDC(info);

	/* set up standard fonts */
	SystemFont = new_font_object(GetStockObject(DEFAULT_GUI_FONT));
	if (SystemFont)
		SystemFont->text = new_string("SystemFont");

	FixedFont = new_font_object(GetStockObject(OEM_FIXED_FONT));
	Times = newfont("Times New Roman", Plain, -10);
	Helvetica = newfont("Arial", SansSerif, -10);
	Courier = newfont("Courier New", FixedWidth, -10);

	protect_object(SystemFont);
	protect_object(FixedFont);
	protect_object(Times);
	protect_object(Helvetica);
	protect_object(Courier);
}
Example #2
0
bool TeletextScreen::InitialiseFont()
{
    static bool initialised = false;
    //QString font = gCoreContext->GetSetting("DefaultSubtitleFont", "FreeMono");
    if (initialised)
    {
        return true;
#if 0
        if (gTTFont->face().family() == font)
            return true;
        delete gTTFont;
#endif // 0
    }

    MythFontProperties *mythfont = new MythFontProperties();
    QString font = SubtitleScreen::GetTeletextFontName();
    if (mythfont)
    {
        QFont newfont(font);
        font.detach();
        mythfont->SetFace(newfont);
        gTTFont = mythfont;
    }
    else
        return false;

    initialised = true;
    LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Loaded main subtitle font '%1'")
        .arg(font));
    return true;
}
Example #3
0
bool SubtitleScreen::InitialiseFont(int fontStretch)
{
    static bool initialised = false;
    QString font = gCoreContext->GetSetting("OSDSubFont", "FreeSans");
    if (initialised)
    {
        if (gTextSubFont->face().family() == font &&
            gTextSubFont->face().stretch() == fontStretch)
        {
            return true;
        }
        delete gTextSubFont;
    }

    MythFontProperties *mythfont = new MythFontProperties();
    if (mythfont)
    {
        QFont newfont(font);
        newfont.setStretch(fontStretch);
        font.detach();
        mythfont->SetFace(newfont);
        mythfont->SetOutline(true, Qt::black, 2, 255);
        gTextSubFont = mythfont;
    }
    else
        return false;

    initialised = true;
    LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Loaded main subtitle font '%1'")
        .arg(font));
    return true;
}
Example #4
0
MakeActionItem::MakeActionItem( const QString& action, const QString& file, const QString& tool, const QString& line )
    : QStandardItem( QString() )
{
    if( tool.isEmpty() || file.isEmpty() )
    {
        setText( line );
    }
    else
    {
        QString itemString = QString(action).append(" ").append(file);
        itemString.append(" (").append(tool).append(")");

        setText( itemString );
    }

    QFont newfont( font() );
    newfont.setBold( true );
    setFont( newfont );
}
Example #5
0
bool SubtitleScreen::Initialise708Fonts(int fontStretch)
{
    static bool initialised = false;
    if (initialised)
    {
        foreach(MythFontProperties* font, gCC708Fonts)
            font->face().setStretch(fontStretch);
        return true;
    }

    LOG(VB_GENERAL, LOG_INFO, "Initialise708Fonts()");

    QStringList fonts;
    fonts.append("Droid Sans Mono"); // default
    fonts.append("FreeMono");        // mono serif
    fonts.append("DejaVu Serif");    // prop serif
    fonts.append("Droid Sans Mono"); // mono sans
    fonts.append("Liberation Sans"); // prop sans
    fonts.append("Purisa");          // casual
    fonts.append("URW Chancery L");  // cursive
    fonts.append("Impact");          // capitals

    int count = 0;
    foreach(QString font, fonts)
    {
        MythFontProperties *mythfont = new MythFontProperties();
        if (mythfont)
        {
            QFont newfont(font);
            newfont.setStretch(fontStretch);
            font.detach();
            mythfont->SetFace(newfont);
            gCC708Fonts.insert(count, mythfont);
            count++;
        }
    }
Example #6
0
caLineEdit::caLineEdit(QWidget *parent) : QLineEdit(parent), FontScalingWidget(this)
{
    // we want this font, while nice and monospace
    QFont font("Lucida Sans Typewriter");
    // if this font does not exist then try a next one
    QFontInfo info(font);
    //font.setStyleStrategy(QFont::NoAntialias);
    QString family = info.family();
    //printf("got font %s\n", qasc(family));
    if(!family.contains("Lucida Sans Typewriter")) {
        QFont  newfont("Monospace");   // not very nice, while a a dot inside the zero to distinguish from o
        newfont.setStyleHint(QFont::TypeWriter);
        setFont(newfont);
    } else {
       setFont(font);
    }

    isShown = false;

    oldStyle = "";
    thisStyle = "";

    setColorMode(Default);
    setAlarmHandling(onForeground);

    thisFormatC[0] = '\0';

    setUnitsEnabled(false);

    thisBackColor = Qt::gray;
    thisForeColor = Qt::black;

    oldBackColor = Qt::black;
    oldForeColor = Qt::gray;

    thisFrameColor = Qt::black;
    oldFrameColor = Qt::gray;

    thisFramePresent = false;

    thisFrameLineWidth = 0;
    oldFrameLineWidth = 0;

    Alarm = 0;

    // default colors will be defined in my event handler by taking them from the palette defined by stylesheet definitions
    //defBackColor = QColor(255, 248, 220, 255);
    //defForeColor = Qt::black;
    defSelectColor = Qt::red; // this does not appear in the palette

    setPrecisionMode(Channel);
    setLimitsMode(Channel);
    setPrecision(0);
    setFormatType(decimal);
    setFormat(0);
    setMinValue(0.0);
    setMaxValue(1.0);
    setFrame(false);

    keepText = "";
    unitsLast = "";
    setTextLine(keepText);
    setValueType(false);

    setFontScaleModeL(WidthAndHeight);
    newFocusPolicy(Qt::NoFocus);

    d_rescaleFontOnTextChanged = true;

    installEventFilter(this);
}