Announcement

Collapse
No announcement yet.

If the font is not installed on the system ...

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

  • If the font is not installed on the system ...

    How to use a font, if the font is not installed on the system ?
    For example, in the code, instead of Arial font I want to use myfont.ttf.
    code:

    !include MUI2.nsh
    !insertmacro MUI_LANGUAGE "English"
    OutFile "Label_MyFont.exe"
    var Label
    Page Custom pre
    Function pre
    nsDialogs::Create 1018

    ${NSD_CreateLabel} 30u 30u 100% 32u "If the Font is not installed on the System"
    Pop $Label
    CreateFont $0 "Arial" 18
    SendMessage $Label ${WM_SETFONT} $0 1

    nsDialogs::Show
    FunctionEnd

    Section
    SectionEnd

    How to do this without having to install the font ?
    It seems that this is done with the function AddFontMemResourceEx.
    Please help solve the problem.

  • #2
    To use a font just in the installer process you would do:

    Function .onguiinit
    Initpluginsdir
    File "/oname=$pluginsdir\myfont.ttf" "c:\mystuff\myfont.ttf"
    System::Call 'GDI32::AddFontResourceEx(t"$pluginsdir\myfont.ttf",i 0x30,i0)'
    FunctionEnd

    (Did not test this, might not work)
    IntOp $PostCount $PostCount + 1

    Comment


    • #3
      Anders, thanks for the tip - works!

      Comment

      Working...
      X