Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #2951 > unrolled thread

Determine if a font is installed in a system

Started bywolverine <wolverine4277@hotmail.com>
First post2012-02-14 13:00 -0800
Last post2012-02-17 15:15 +0000
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Determine if a font is installed in a system wolverine <wolverine4277@hotmail.com> - 2012-02-14 13:00 -0800
    Re: Determine if a font is installed in a system "Uwe Heyer" <uwe.heyer@aristik.de> - 2012-02-15 18:24 +0000
      Re: Determine if a font is installed in a system wolverine <wolverine4277@hotmail.com> - 2012-02-16 07:10 -0800
        Re: Determine if a font is installed in a system "Jamal" <vodotnet_nospam@yahoo.com> - 2012-02-16 10:52 -0500
        Re: Determine if a font is installed in a system "Uwe Heyer" <uwe.heyer@aristik.de> - 2012-02-17 15:15 +0000

#2951 — Determine if a font is installed in a system

Fromwolverine <wolverine4277@hotmail.com>
Date2012-02-14 13:00 -0800
SubjectDetermine if a font is installed in a system
Message-ID<1260cf9f-fa9c-40a6-ac56-9bfb5f386b1d@h6g2000yqk.googlegroups.com>
I need to verify if a font is installed in a system. The code that i
try to use is the one indicated in

http://groups.google.com/group/comp.lang.clipper.visual-objects/browse_thread/thread/3f8446da872b91c1/9c6340ea2b96e721?hl=es&lnk=gst&q=how+to+install+font#9c6340ea2b96e721

The problem is that every time the return value of EnumFontFamiliesEx
is 1. Is the font is installed the result is 1, same if the font is
not installed.
Any clue?
Thanks.

Sebastián


METHOD Test() CLASS TestWindow

	LOCAL cFontName:= NULL_STRING AS STRING
	LOCAL sFontAttribute IS _winLOGFONT
	LOCAL dwEnumerationResult:= 0 AS DWORD

	cFontName:= SELF:oDCSLEFontName:TextValue // for example "Verdana"
	MemCopyString(@sFontAttribute.lfFaceName, cFontName, SLen(cFontName))
	dwEnumerationResult:= EnumFontFamiliesEx(GetDC(SELF:Handle()),
@sFontAttribute, @EnumFontFamExProc(), 0, 0)
	IF (dwEnumerationResult == 99)
		InfoBox{SELF, "Info", "Font " + cFontName + " installed."}:Show()
	ELSE
		InfoBox{SELF, "Info", "Font " + cFontName + " not
installed."}:Show()
	ENDIF

	RETURN NIL


FUNCTION EnumFontFamExProc(lpelfe AS _winENUMLOGFONTEX, lpntme AS
_winNEWTEXTMETRICEX, FontType AS DWORD, lParam AS DWORD) AS INT
CALLBACK

	//InfoBox{NULL_OBJECT, "Font", Psz2String(@lpelfe.elfFullName) + ", "
+ Psz2String(@lpelfe.elfStyle) + ", " +
Psz2String(@lpelfe.elfScript)}:Show()

	RETURN 1


_DLL FUNCTION EnumFontFamiliesEx(hDC AS PTR, lpLogFont AS _winLOGFONT,
lpEnumFontFamExProc AS PTR, lParam AS DWORD, dwFlags AS DWORD) AS
DWORD PASCAL:GDI32.EnumFontFamiliesExA

[toc] | [next] | [standalone]


#2953

From"Uwe Heyer" <uwe.heyer@aristik.de>
Date2012-02-15 18:24 +0000
Message-ID<9q2bicFmp3U1@mid.individual.net>
In reply to#2951
wolverine wrote:

Sebastián,

description of EnumFontFamiliesEx

Return Values
The return value is the last value returned by the callback function.
This value depends on which font families are available for the
specified device.


and you code

FUNCTION EnumFontFamExProc(lpelfe AS _winENUMLOGFONTEX, lpntme AS
_winNEWTEXTMETRICEX, FontType AS DWORD, lParam AS DWORD) AS INT
CALLBACK

	//InfoBox{NULL_OBJECT, "Font", Psz2String(@lpelfe.elfFullName) + ", "
+ Psz2String(@lpelfe.elfStyle) + ", " +
Psz2String(@lpelfe.elfScript)}:Show()

	RETURN 1

-----------------------------

following your code EnumFontFamiliesEx() will return everytime 1 and
nothing else


-Uwe

[toc] | [prev] | [next] | [standalone]


#2960

Fromwolverine <wolverine4277@hotmail.com>
Date2012-02-16 07:10 -0800
Message-ID<e74e0ba8-8aa7-44fc-ae13-fc75e5a5111e@k40g2000yqf.googlegroups.com>
In reply to#2953
Thanks, my mistake. I don't read the description of
EnumFontFamiliesExe very well :S
With a little change on EnumFontFamExProc is working fine.
Now, i have another problem try to installing a font with Windows 7.
When i try to copy the font to the folder font fails because the user
permissions.
The font is installed but not copied, there are some problem with
that? I can use the font in the applications but i don't see that font
in the control panel > fonts.
Regards.


On 15 feb, 15:24, "Uwe Heyer" <uwe.he...@aristik.de> wrote:
> wolverine wrote:
>
> Sebastián,
>
> description of EnumFontFamiliesEx
>
> Return Values
> The return value is the last value returned by the callback function.
> This value depends on which font families are available for the
> specified device.
>
> and you code
>
> FUNCTION EnumFontFamExProc(lpelfe AS _winENUMLOGFONTEX, lpntme AS
> _winNEWTEXTMETRICEX, FontType AS DWORD, lParam AS DWORD) AS INT
> CALLBACK
>
>         //InfoBox{NULL_OBJECT, "Font", Psz2String(@lpelfe.elfFullName) + ", "
> + Psz2String(@lpelfe.elfStyle) + ", " +
> Psz2String(@lpelfe.elfScript)}:Show()
>
>         RETURN 1
>
> -----------------------------
>
> following your code EnumFontFamiliesEx() will return everytime 1 and
> nothing else
>
> -Uwe

[toc] | [prev] | [next] | [standalone]


#2962

From"Jamal" <vodotnet_nospam@yahoo.com>
Date2012-02-16 10:52 -0500
Message-ID<jhj8o8$6o7$1@dont-email.me>
In reply to#2960
May you need to set the application Run As Administrator.

Jamal

"wolverine"  wrote in message 
news:e74e0ba8-8aa7-44fc-ae13-fc75e5a5111e@k40g2000yqf.googlegroups.com...

Thanks, my mistake. I don't read the description of
EnumFontFamiliesExe very well :S
With a little change on EnumFontFamExProc is working fine.
Now, i have another problem try to installing a font with Windows 7.
When i try to copy the font to the folder font fails because the user
permissions.
The font is installed but not copied, there are some problem with
that? I can use the font in the applications but i don't see that font
in the control panel > fonts.
Regards.


On 15 feb, 15:24, "Uwe Heyer" <uwe.he...@aristik.de> wrote:
> wolverine wrote:
>
> Sebastián,
>
> description of EnumFontFamiliesEx
>
> Return Values
> The return value is the last value returned by the callback function.
> This value depends on which font families are available for the
> specified device.
>
> and you code
>
> FUNCTION EnumFontFamExProc(lpelfe AS _winENUMLOGFONTEX, lpntme AS
> _winNEWTEXTMETRICEX, FontType AS DWORD, lParam AS DWORD) AS INT
> CALLBACK
>
>         //InfoBox{NULL_OBJECT, "Font", Psz2String(@lpelfe.elfFullName) + 
> ", "
> + Psz2String(@lpelfe.elfStyle) + ", " +
> Psz2String(@lpelfe.elfScript)}:Show()
>
>         RETURN 1
>
> -----------------------------
>
> following your code EnumFontFamiliesEx() will return everytime 1 and
> nothing else
>
> -Uwe 

[toc] | [prev] | [next] | [standalone]


#2971

From"Uwe Heyer" <uwe.heyer@aristik.de>
Date2012-02-17 15:15 +0000
Message-ID<9q798kF727U1@mid.individual.net>
In reply to#2960
 
Sebastián,

topic: font installation 

http://msdn.microsoft.com/en-us/library/dd144833(v=vs.85).aspx

Hope this is of some help
-Uwe

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web