Beispiel #1
0
wxCoord wxDC::GetCharHeight() const
{
    wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
    wxCHECK_MSG( m_font.Ok(), -1, wxT("no font selected") );

    int h = -1;
    GetCurrentFont()->GetHeight(&h);
    return YDEV2LOGREL(h);
}
Beispiel #2
0
void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
                           wxCoord *descent, wxCoord *externalLeading,
                           wxFont *theFont) const
{
    wxCHECK_RET( Ok(), wxT("invalid dc") );
    wxCHECK_RET( m_font.Ok(), wxT("no font selected") );
    wxCHECK_RET( !theFont || theFont->Ok(), wxT("invalid font") );

    wxFont oldFont;
    if ( theFont != NULL )
    {
        oldFont = m_font;
        wxConstCast(this, wxDC)->SetFont(*theFont);
    }

    wxCoord xx = 0, yy = 0;
    DFBRectangle rect;
    wxIDirectFBFontPtr f = GetCurrentFont();

    if ( f->GetStringExtents(wxSTR_TO_DFB(string), -1, &rect, NULL) )
    {
        // VS: YDEV is corrent, it should *not* be XDEV, because font's are
        //     only scaled according to m_scaleY
        xx = YDEV2LOGREL(rect.w);
        yy = YDEV2LOGREL(rect.h);

        if ( descent )
        {
            int d;
            if ( f->GetDescender(&d) )
                *descent = YDEV2LOGREL(-d);
            else
                *descent = 0;
        }
    }

    if ( x ) *x = xx;
    if ( y ) *y = yy;
    if ( externalLeading ) *externalLeading = 0;

    if ( theFont != NULL )
        wxConstCast(this, wxDC)->SetFont(oldFont);
}
Beispiel #3
0
wxCoord wxDC::GetCharWidth() const
{
    wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
    wxCHECK_MSG( m_font.Ok(), -1, wxT("no font selected") );

    int w = -1;
    GetCurrentFont()->GetStringWidth("H", 1, &w);
    // VS: YDEV is corrent, it should *not* be XDEV, because font's are only
    //     scaled according to m_scaleY
    return YDEV2LOGREL(w);
}
Beispiel #4
0
wxCoord wxSVGFileDC::DeviceToLogicalYRel(wxCoord y) const
{
    return YDEV2LOGREL(y);
}