Announcement

Collapse
No announcement yet.

Os Common Script Font

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    It's not just WIndows which installs fonts..

    Most word-processing applications include a set of fonts.

    Every HP printer I have installed has included some fonts, too.

    Not to mention, you can buy a "font pack" CD at Office Max for ten bucks and install that, too.

    Leave a comment:


  • Chris Boss
    replied
    Here is a slightly more extended list of fonts that should be on most, if not all computers: (The ones with the (X) are the actual font)

    Arial (X)
    Courier New (X)
    Symbol
    Times New Roman (X)
    Wingdings
    Terminal
    Courier
    Modern
    MS Sans Serif (X)
    MS Serif
    Arial Black (X)
    Book Antiqua (X)
    Calisto MT
    Century Gothic
    Copperplate Gothic
    Impact (X)
    Lucida Console (X)
    Lucida Handwriting Italic
    Lucida Sans Italic
    OCR A Extended
    Tahoma (X)
    Verdana (X)
    Westminster
    Webdings

    I don't know how this list holds up on Vista though.
    Last edited by Chris Boss; 4 Mar 2008, 05:47 PM.

    Leave a comment:


  • Kev Peel
    replied
    Windows may not be the head programmer, but it's font mapper is quite clever in that you can set a couple of attributes to a LOGFONT structure and it will find the best match. If you don't want to include a 100KB TTF font file with your application, then you need to let Windows auto-detect a match.

    At least on Windows Vista, the following code will show the first "Script" font available:

    Code:
     
    #Compile Exe
    #Dim All
    #Include "WIN32API.INC"
    Function PBMain
      Local hDlg As Dword
      Local hFont As Dword
      Local lf As LOGFONT
      ' Create the font...
      lf.lfFaceName = "script" ' <- Important for best match.
      lf.lfCharset = %OEM_CHARSET
      lf.lfHeight = -32
      lf.lfWeight = %FW_NORMAL
      lf.lfUnderline = %TRUE       
      lf.lfPitchAndFamily = %VARIABLE_PITCH Or %FF_SCRIPT Or %FF_DECORATIVE    ' <- Important for best match.
      hFont = CreateFontIndirect(lf)
      ' Create example dialog to display the font...
      Dialog New %HWND_DESKTOP, "Font Test", , , 300, 50, %WS_OVERLAPPEDWINDOW To hDlg
      Control Add Label, hDlg, 100, "Please Show Me Some Fancy Text Now!", 10, 8, 300, 50
      Control Send hDlg, 100, %WM_SETFONT, hFont, %FALSE
      Dialog Show Modal hDlg
    End Function

    Leave a comment:


  • George Deluca
    replied
    I agree, the best solution is probably to ship a script font as part of your install. There's lots of free ones (see for example http://simplythebest.net/fonts/script_fonts.html) and I'm sure some of them are also redistributable.

    Leave a comment:


  • Michael Mattias
    replied
    If you can obtain a font file and the right to redistribute it (e.g., you may NOT just willy-nilly redistribute the font files from your computer!), I have posted an example here of how use a font file in your application. Then you CAN use the same font regardless of target computer system.

    Search on "AddFontResource" in message text. It may or may not be in the Source Code Forum.



    MCM
    Last edited by Michael Mattias; 3 Mar 2008, 08:21 PM.

    Leave a comment:


  • BRENT GARDNER
    replied
    Anyone have code to create "Script MT bold" , point 13, indirect, so can use for all operating systems and computers?

    How silly, I forgot windows is the head programer, not me. It will use
    whatever font is on computer that is similiar to what I want. I had the
    mistaken idea that I could create font specific for my program.

    Leave a comment:


  • Michael Mattias
    replied
    Sheesh, am I a nice guy or what?
    Code:
    ' FindScriptFontsOnMySystem.BAS
    ' 03.01.08
    ' MCM
    
    #COMPILE EXE
    #DIM     ALL
    
    
    #INCLUDE "Win32API.INC"
    
    FUNCTION PBMAIN () AS LONG
        
     LOCAL s AS STRING, hDC AS LONG, iRet AS LONG
       ' get required DC for enumfonts call
        hDC    = GETDC (BYVAL %NULL)
        iRet   = Enumfonts ( hDc, BYVAL %NULL, CODEPTR (FindScriptFontsCallback), VARPTR(s))
        MSGBOX   S, %MB_ICONINFORMATION, "Available TrueType Script Fonts on this system"
    END FUNCTION
    
    
    FUNCTION FindScriptFontsCallback ( LF AS LOGFONT, TM AS TEXTMETRIC, BYVAL dwType AS LONG, S AS STRING) AS LONG
     ' pick out only True-Type (so they are scalable) and Script fonts (because that's what we want),
     ' add them to the string and continue enumeration until there ain't no more
       IF dwType = %TRUETYPE_FONTTYPE THEN
          IF ISTRUE (LF.lfPitchAndFamily AND %FF_SCRIPT)  THEN
              IF LEN(S) THEN
                  S = S & $CRLF
              END IF
              S = S & LF.lfFaceName
          END IF
       END IF
       FUNCTION = %TRUE
    END FUNCTION
    PS: Including any available NON-TrueType script-style fonts and including the available sizes in message left to you. If not TrueType they are only available in the nominated sizes; but you can CreateFontIndirect from them as noted by Kev.

    MCM
    Last edited by Michael Mattias; 1 Mar 2008, 11:16 AM.

    Leave a comment:


  • Kev Peel
    replied
    Use GetStockObject() for the default GUI font, then GetObject, modify the LOGFONT structure to your taste, and finally use CreateFontIndirect to recreate the font. This is useful if you need bold fonts, italic, etc.

    The fonts returned by GetStockObject() are always available.

    Leave a comment:


  • Michael Mattias
    replied
    I have posted this multiple times, but here it is again:

    Available on ALL Windows' systems:
    • Courier New (monospaced)
    • Arial (proportional sans serif)
    • Times New Roman (proportional, serifed)
    • Symbol (weird stuff)

    Available on "current system" : EnumFonts() and/or EnumFontFamilies() Windows API functions... I know there are demos in the source code forum.

    Leave a comment:


  • BRENT GARDNER
    started a topic Os Common Script Font

    Os Common Script Font

    My program written in PBWIN 8.4 ON Windows XP, uses a script font.
    "Script MT Bold". But when I install on Windows Vista, that font is not available. Also, on Windows 98, font not available? How does one find a font common to all operating systems? This is crucial for my program as the textbox width size determines how text is printed out.

    Later...

    Anyone have code to create "Script MT bold" , point 13, indirect, so can use for all operating systems
    and computers?
    Last edited by BRENT GARDNER; 2 Mar 2008, 11:24 AM. Reason: Clarify need
Working...
X