Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
True foxels to pixels
Message
From
15/01/2014 04:53:53
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
True foxels to pixels
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01591898
Message ID:
01591898
Views:
214
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   
Next
Reply
Map
View

Click here to load this message in the networking platform