Schriftart

  • Hey Leute,

    Kann man bei einem Label eine Schriftart benutzten die nicht im Font-Ordner registriert ist.
    Ich möchte die Rechner von anderen nicht mit Schriftarten zumüllen
    und bei Vista muss man das kopieren auch noch betätigen also wär es die beste Lösung (denke ich :D)
    weis einer wie ich das machen muss?

    Mfg Keyle

  • In der Hilfe ( Anhang ---> Standard Windows Schriftarten) findest Du eine Übersicht welche Deine Frage beantwortet.

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl

  • Zitat

    Kann man bei einem Label eine Schriftart benutzten die nicht im Font-Ordner registriert ist.


    Antwort: Nein

    Wenn es sich nur um ein oder 2 Label handelt, dann würde ich das ganze als Bild einfügen...

    MfG Schnuffel

    "Sarkasmus ist die niedrigste Form des Witzes, aber die höchste Form der Intelligenz."
    Val McDermid

    ein paar Infos ...

    Wer mehr als "nur" Hilfe benötigt, kann sich gern im Forum "Programmieranfragen" an uns wenden. Wir helfen in allen Fällen, die die Forenregeln zulassen.

    Für schnelle Hilfe benötigen wir ein ! lauffähiges ! Script, dass wir als Demonstration des Problems testen können. Wer von uns erwartet ein Teilscript erstmal lauffähig zu bekommen, der hat
    1. keine wirkliche Not
    2. keinen Respekt vor Menschen die ihm in ihrer Freizeit Ihre Hilfe anbieten
    3. oder ist einfach nur faul und meint wir coden das für ihn

    In solchen Fällen erlaube ich mir, die Anfrage einfach zu ignorieren. ;)

  • Hier bitte, aus der noch nicht fertigen GDI-Sammlung:

    Spoiler anzeigen
    [autoit]

    ;-- Font Constants ------
    #Region Font Constants
    Global Const $FR_PRIVATE = 0x10
    Global Const $FR_NOT_ENUM = 0x20
    #EndRegion Font Constants
    ; -----------------------
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDI_AddFontResourceEx
    ; Description ...: adds the font resource from the specified file to the system.
    ; Fonts added with the AddFontResourceEx function can be marked as private and not enumerable.
    ; Syntax.........: _GDI_AddFontResourceEx($lpszFilename, $fl, $pdv = 0)
    ; Parameters ....: $lpszFilename - [in] Pointer to a null-terminated character string that contains a valid font file name.
    ; This parameter can specify any of the following files.
    ; File Extension Meaning
    ; .fon Font resource file.
    ; .fnt Raw bitmap font file.
    ; .ttf Raw TrueType file.
    ; .ttc East Asian Windows: TrueType font collection.
    ; .fot TrueType resource file.
    ; .otf PostScript OpenType font.
    ; .mmm Multiple master Type1 font resource file.
    ; It must be used with .pfm and .pfb files.
    ; .pfb Type 1 font bits file. It is used with a .pfm file.
    ; .pfm Type 1 font metrics file. It is used with a .pfb file.
    ; To add a font whose information comes from several resource files,
    ; point lpszFileName to a string with the file names separated
    ; by a | --for example, abcxxxxx.pfm | abcxxxxx.pfb.
    ; $fl - [in] Specifies characteristics of the font to be added to the system.
    ; This parameter can be one of the following values.
    ; $FR_PRIVATE Specifies that only the process that called the AddFontResourceEx
    ; function can use this font. When the font name matches a public
    ; font, the private font will be chosen. When the process terminates,
    ; the system will remove all fonts installed by the process with
    ; the AddFontResourceEx function.
    ; $FR_NOT_ENUM Specifies that no process, including the process that called the
    ; AddFontResourceEx function, can enumerate this font.
    ; $pdv - [in] Reserved. Must be zero.
    ; Return values .: Success - the number of fonts added.
    ; Failure - 0 (No extended error information is available.)
    ; Author ........: Greenhorn
    ; Modified.......:
    ; Remarks .......: This function allows a process to use fonts without allowing other processes access to the fonts.
    ; When an application no longer needs a font resource it loaded by calling the AddFontResourceEx function,
    ; it must remove the resource by calling the RemoveFontResourceEx function.
    ; This function installs the font only for the current session. When the system restarts, the font will not
    ; be present. To have the font installed even after restarting the system, the font must be listed in the registry.
    ; Related .......:
    ; Link ..........; @@MsdnLink@@ AddFontResourceEx
    ; Example .......;
    ; ===============================================================================================================================
    Func _GDI_AddFontResourceEx($lpszFilename, $fl, $pdv = 0)

    If Not IsNumber($pdv) Or $pdv <> 0 Then $pdv = 0
    Local $aResult = DllCall("gdi32.dll", 'int', 'AddFontResourceExW', 'wstr', $lpszFilename, 'dword', $fl, 'ptr', $pdv)
    If @error Then Return SetError(@error, 0, False)
    Return $aResult[0]

    EndFunc ;==>_GDI_AddFontResourceEx

    [/autoit]
  • Cool =)
    Du machst ne GDI Sammlung? ^^

  • Wie benutzt man genau die UDF? Also So funktioniert das nicht:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.0.0
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $FR_PRIVATE = 0x10
    Global Const $FR_NOT_ENUM = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>
    #include <WinAPI.au3>
    #include <GDIPlus.au3>
    #include <Memory.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $aCredits = StringSplit("Super Autoit Mario;;Coded by:;Eukalyptus;Gummibaer;;Special THX to:;Progandy;BrettF;GtaSpider;Zedna;Martin;Funkey;;http://www.autoit.de;http://www.autoitscript.com;http://www.un4seen.com;;Autoit 3.3.0.0;2009;;;This Game is still beta :)", ";")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", 421, 312)
    ;~ GUISetBkColor(0xFFFFFF)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $Ret = _GDI_AddFontResourceEx(@ScriptDir & "\raindrops.TTF", $FR_PRIVATE)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1)
    $hBMP = _GDIPlus_BitmapCreateFromGraphics(292, 55, $hGraphic)
    _GDIPlus_GraphicsDispose($hGraphic)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMP)
    _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, 292, 55, _GDIPlus_BrushCreateSolid(0xFFFEFEFE))

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawString($hGraphic, "Hallo", 1, 1, "Raindrop Splash")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hBitmap_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $pic = GUICtrlCreatePic("", 100, 100, 100, 55)
    _SetBitmapToCtrl($pic, $hBitmap_GDI)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _SetBitmapToCtrl($CtrlId, $hBitmap)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local Const $SS_BITMAP = 0xE
    Local Const $GWL_STYLE = -16

    [/autoit] [autoit][/autoit] [autoit]

    Local $hWnd = GUICtrlGetHandle($CtrlId)
    If $hWnd = 0 Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE)
    If @error Then Return SetError(2, 0, 0)
    DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP))
    If @error Then Return SetError(3, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $oldBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap)
    If @error Then Return SetError(4, 0, 0)
    If $oldBmp[0] <> 0 Then DllCall("GDI32.dll", "int", "DeleteObject", "int", $oldBmp[0])
    Return 1
    EndFunc ;==>_SetBitmapToCtrl

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GDI_AddFontResourceEx($lpszFilename, $fl, $pdv = 0) ,;Progandy
    If Not IsNumber($pdv) Or $pdv <> 0 Then $pdv = 0
    Local $aResult = DllCall("gdi32.dll", 'int', 'AddFontResourceExW', 'wstr', $lpszFilename, 'dword', $fl, 'ptr', $pdv)
    If @error Then Return SetError(@error, 0, False)
    Return $aResult[0]
    EndFunc ;==>_GDI_AddFontResourceEx

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]
  • Für GDIplus funktioniert das nicht. da gibt es andere Funktionen, siehe hier: http://www.autoitscript.com/forum/index.php?showtopic=94679

    UDFs
    [autoit]

    $hCollection = _GDIPlus_NewPrivateFontCollection()
    _GDIPlus_PrivateAddFontFile($hCollection, "C:\MyFont.ttf")
    $hFontFamily = _GDIPlus_CreateFontFamilyFromName("MyFont", $hCollection)
    $hFont = _GDIPlus_FontCreate ($hFontFamily, 12, 2)

    [/autoit] [autoit][/autoit] [autoit]

    ; ...

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFontFamily)
    _GDIPlus_DeletePrivateFontCollection($hCollection)

    [/autoit][autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_NewPrivateFontCollection
    ; Description ...: Creates an PrivateFontCollection object.
    ; Syntax.........: _GDIPlus_NewPrivateFontCollection()
    ; Parameters ....:
    ; Return values .: Success - a pointer to the PrivateFontCollection object.
    ; Failure - 0
    ; Author ........: Prog@ndy, Yashied
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........; @@MsdnLink@@ GdipNewPrivateFontCollection
    ; Example .......;
    ; ===============================================================================================================================
    Func _GDIPlus_NewPrivateFontCollection()
    Local $aResult = DllCall($ghGDIPDll, 'int', 'GdipNewPrivateFontCollection', 'ptr*', 0)
    If @error Then Return SetError(1,0,0)
    Return SetError($aResult[0],0,$aResult[1])
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_PrivateAddFontFile
    ; Description ...: Adds a font file to this private font collection.
    ; Syntax.........: _GDIPlus_PrivateAddFontFile($hCollection, $sFonfile)
    ; Parameters ....: $hCollection - [in] Pointer to the font collection object.
    ; $sFontfile - [in] Pointer to a null-terminated unicode string that specifies the name of a font file.
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Prog@ndy, Yashied
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........; @@MsdnLink@@ GdipPrivateAddFontFile
    ; Example .......;
    ; ===============================================================================================================================
    Func _GDIPlus_PrivateAddFontFile($hCollection, $sFontfile)
    Local $aResult = DllCall($ghGDIPDll, 'int', 'GdipPrivateAddFontFile', 'ptr', $hCollection, 'wstr', $sFontfile)
    If @error Then Return SetError(1,0,False)
    Return SetError($aResult[0],0,$aResult[0]=0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_CreateFontFamilyFromName
    ; Description ...: Creates a FontFamily object based on a specified font family.
    ; Syntax.........: _GDIPlus_CreateFontFamilyFromName($sFontname, $hCollection)
    ; Parameters ....: $sFontname - [in] Name of the font family. For example, Arial.ttf is the name of the Arial font family.
    ; $$hCollection - [in] Pointer to a FontCollection object that specifies the collection that the font family
    ; belongs to. If FontCollection is NULL, this font family is not part of a collection.
    ; The default value is NULL.

    [/autoit] [autoit][/autoit] [autoit]

    ; Return values .: Success - a pointer to the new FontFamily object.
    ; Failure - 0
    ; Author ........: Prog@ndy, Yashied
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........; @@MsdnLink@@ GdipCreateFontFamilyFromName
    ; Example .......;
    ; ===============================================================================================================================
    Func _GDIPlus_CreateFontFamilyFromName($sFontname, $hCollection=0)
    Local $aResult = DllCall($ghGDIPDll, 'int', 'GdipCreateFontFamilyFromName', 'wstr', $sFontname, 'ptr', $hCollection, 'ptr*', 0)
    If @error Then Return SetError(1,0,0)
    Return SetError($aResult[0],0,$aResult[3])
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_DeletePrivateFontCollection
    ; Description ...: Deletes the specified PrivateFontCollection object.
    ; Syntax.........: _GDIPlus_DeletePrivateFontCollection($hCollection)
    ; Parameters ....: $hCollection - [in] Pointer to the PrivateFontCollection object to delete.
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Prog@ndy, Yashied
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........; @@MsdnLink@@ GdipDeletePrivateFontCollection
    ; Example .......;
    ; ===============================================================================================================================
    Func _GDIPlus_DeletePrivateFontCollection($hCollection)
    Local $aResult = DllCall($ghGDIPDll, 'int', 'GdipDeletePrivateFontCollection', 'ptr*', $hCollection)
    If @error Then Return SetError(1,0,False)
    Return SetError($aResult[0],0,$aResult[0]=0)
    EndFunc

    [/autoit]

    //Edit: und wieso machst du das mit GDI+? So reicht es doch auch:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.0.0
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $FR_PRIVATE = 0x10
    Global Const $FR_NOT_ENUM = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", 421, 312)

    [/autoit] [autoit][/autoit] [autoit]

    $Ret = _GDI_AddFontResourceEx(@ScriptDir & "\raindrops.TTF", BitOR($FR_PRIVATE, $FR_NOT_ENUM))

    [/autoit] [autoit][/autoit] [autoit]

    $pic = GUICtrlCreateLabel("HALLO USW USF hallo", 100, 100, 200, 80)
    GUICtrlSetFont(-1, 24, 400, 0, "Raindrop Splash")

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDI_AddFontResourceEx($lpszFilename, $fl, $pdv = 0) ;Progandy
    If Not IsNumber($pdv) Or $pdv <> 0 Then $pdv = 0
    Local $aResult = DllCall("gdi32.dll", 'int', 'AddFontResourceExW', 'wstr', $lpszFilename, 'dword', $fl, 'ptr', $pdv)
    If @error Then Return SetError(@error, 0, False)
    Return $aResult[0]
    EndFunc ;==>_GDI_AddFontResourceEx

    [/autoit]

    2 Mal editiert, zuletzt von progandy (26. September 2009 um 14:32)