Beispiel #1
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;
}
Beispiel #2
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;
}
Beispiel #3
0
void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod,
                      QRect clipRect)
{
    m_DirtyRegion = QRegion(QRect(0, 0, 0, 0));

    if (!m_Visible || m_Vanished)
        return;

    QRect realArea = m_Area.toQRect();
    realArea.translate(xoffset, yoffset);

    if (!realArea.intersects(clipRect))
        return;

    DrawSelf(p, xoffset, yoffset, alphaMod, clipRect);

    QList<MythUIType *>::Iterator it;

    for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it)
    {
        (*it)->Draw(p, xoffset + m_Area.x(), yoffset + m_Area.y(),
                    CalcAlpha(alphaMod), clipRect);
    }

    if (p->ShowBorders())
    {
        static const QBrush nullbrush(Qt::NoBrush);
        p->DrawRect(realArea, nullbrush, QPen(m_BorderColor), 255);

        if (p->ShowTypeNames())
        {
            MythFontProperties font;
            font.SetFace(QFont("Droid Sans"));
            font.SetColor(m_BorderColor);
            font.SetPointSize(8);
            p->DrawText(realArea, objectName(), 0, font, 255, realArea);
        }
    }
}
Beispiel #4
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++;
        }
    }