Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
True foxels to pixels
Message
De
15/01/2014 04:53:53
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
True foxels to pixels
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01591898
Message ID:
01591898
Vues:
213
Does anyone know of a true algorithm which mimics VFP's foxels to pixels conversion?

I found this algorithm online and modified it somewhat to adjust for the font attributes bold, underline, and italics. It ranges in accuracy (depending on the font and attributes) from being perfect, to being within a few pixels of being accurate.

I can't figure out what VFP is doing to convert foxels to pixels as it does. Does anyone know?
**********
* Converts VFP foxels to screen pixels
* tnFoxels        - fractional foxel value to convert
* tlVertical      - Is this a Y coordinate?
* tcFontName      - "Arial" for example
* tnFontSize      - 10
* tlFontBold      - Is the font bold?
* tlFontItalics   - Is the font in italics?
* tlFontUnderline - Is the font underlined?
*****
FUNCTION foxels_to_pixels
LPARAMETERS tnFoxels, tlVertical, tcFontName, tnFontSize, tlFontBold, tlFontItalics, tlFontUnderline
LOCAL lcStyle
    **********
    * Note:     B Bold
    *           I Italic
    *           N Normal
    *           O Outline
    *           Q Opaque
    *           S Shadow
    *           – Strikeout
    *           T Transparent
    *           U Underline
    *****
    lcStyle = IIF(tlFontBold, "B", "") + IIF(tlFontItalics, "I", "") + IIF(tlFontUnderline, "U", "")
    IF PCOUNT() > 2
        RETURN tnFoxels * FONTMETRIC(IIF(tlVertical, 1, 6), tcFontName, tnFontSize, lcStyle)
    ELSE
        RETURN tnFoxels * FONTMETRIC(IIF(tlVertical, 1, 6))
    ENDIF   
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform