Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Win API / March 2007



Tip: Looking for answers? Try searching our database.

Font API

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Backslash - 14 Mar 2007 18:33 GMT
How can I load some specific fonts, like all Bengali Fonts...

I was able to list Arabic, English, Hebrew, etc fonts but unable to
list Bengali, Hindi Fonts...

Is there any API or other techniques to list those [Bengali, Hindi]
fonts?

plzz, help me... thanX in advance....

[Sorry for my poor English]
Ken Halter - 14 Mar 2007 19:17 GMT
> How can I load some specific fonts, like all Bengali Fonts...
>
[quoted text clipped - 7 lines]
>
> [Sorry for my poor English]

This sample shows a way to get quite a bit of info from an installed font. I
didn't look, but I don't think I have any 'Bengali' or similar fonts
installed... so...

Font Properties with AddressOf
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=38897&lngWId=1

Signature

Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm

Thorsten Albers - 14 Mar 2007 22:23 GMT
Backslash <torifat@gmail.com> schrieb im Beitrag
<1173893610.779635.156620@o5g2000hsb.googlegroups.com>...
> How can I load some specific fonts, like all Bengali Fonts...

What do you mean by "load"? A font has to be installed in the system's font
list. To do this by code use AddFontResource().

> I was able to list Arabic, English, Hebrew, etc fonts but unable to
> list Bengali, Hindi Fonts...

It is rather unlikely that an arabic, english, and hebrew font are listed
while bengali or hindi fonts are not! If they have been installed properly
they should be listed all the same way because there is no difference
between a TrueType font file and a TrueType font file...

> Is there any API or other techniques to list those [Bengali, Hindi]
> fonts?

The technique to list a bengali or hindi font is the same to be used to
list a arabic, english, hebrew, etc. font.

Signature

----------------------------------------------------------------------
THORSTEN ALBERS                       Universität Freiburg
                                               albers@
                                                      uni-freiburg.de
----------------------------------------------------------------------

Backslash - 16 Mar 2007 15:57 GMT
On Mar 15, 3:23 am, "Thorsten Albers" <alber...@MOVEuni-freiburg.de>
wrote:
> Backslash <tori...@gmail.com> schrieb im Beitrag
> <1173893610.779635.156...@o5g2000hsb.googlegroups.com>...
[quoted text clipped - 3 lines]
> What do you mean by "load"? A font has to be installed in the system's font
> list. To do this by code use AddFontResource().

Load Means- Load in listbox or combobox, I know how to install a
font...

> > I was able to list Arabic, English, Hebrew, etc fonts but unable to
> > list Bengali, Hindi Fonts...
[quoted text clipped - 3 lines]
> they should be listed all the same way because there is no difference
> between a TrueType font file and a TrueType font file...

Problem is codepage not TTF file

> > Is there any API or other techniques to list those [Bengali, Hindi]
> > fonts?
>
> The technique to list a bengali or hindi font is the same to be used to
> list a arabic, english, hebrew, etc. font.

It not works for me...

> --
> ----------------------------------------------------------------------
> THORSTEN ALBERS                                 Universität Freiburg
>                                                 albers@
>                                                        uni-freiburg.de
> ----------------------------------------------------------------------
Thorsten Albers - 16 Mar 2007 18:14 GMT
Backslash <torifat@gmail.com> schrieb im Beitrag
<1174057035.808600.111500@y66g2000hsf.googlegroups.com>...
> Load Means- Load in listbox or combobox, I know how to install a
> font...

I see what you mean: Assign the font to a control.

Any font is assigned to a control by setting the Font.Name property to the
face name of the font. Note, that on MS Windows 9x with font sizes less or
equal then 8 points you should do as follows
Font.Size = 6
Font.Name = "My Font"
Font.Size = 6 ' 2nd time...

But this presumably isn't your problem.

> Problem is codepage not TTF file

- Give us the name of the bengali and/or hindi font you want to assign
- Show us the code you are using to list the fonts
- Show us the code you are using to assign the font to your control

Signature

----------------------------------------------------------------------
THORSTEN ALBERS                       Universität Freiburg
                                               albers@
                                                      uni-freiburg.de
----------------------------------------------------------------------

Mark Yudkin - 18 Mar 2007 09:42 GMT
Without code, and system setup, it's impossible to do anything but a wild
guess. First off, make sure you have Windows 2000, XP or Vista (you failed
to list the OS).

Since you have Arabic and Hebrew working, but not the Indic fonts, you
should verify that you have installed the relevant support. First off note
that Hindi is a language and not a font, and that it has two distinct
writing systems. The Indic font for Hindi is Devanagan, the arabic font you
already have working according to your post.

Start -> Control Panel -> Regional and Language Options -> Languages. Make
sure that both check boxes in Supplemental language support are checked.
Click advanced on Text services and input languages and make sure you've set
up Hindi and Bengali as input languages.

Start -> Control Panel -> Regional and Language Options -> Advanced.
Validate the code page conversion tables, such as 57002 and 57003 for your
case.

If all of this is OK, post your code.

> How can I load some specific fonts, like all Bengali Fonts...
>
[quoted text clipped - 7 lines]
>
> [Sorry for my poor English]
Backslash - 18 Mar 2007 16:03 GMT
On Mar 18, 2:42 pm, "Mark Yudkin" <DoNotContac...@boingboing.org>
wrote:
> Without code, and system setup, it's impossible to do anything but a wild
> guess. First off, make sure you have Windows 2000, XP or Vista (you failed
[quoted text clipped - 5 lines]
> writing systems. The Indic font for Hindi is Devanagan, the arabic font you
> already have working according to your post.

Yep, I missed it... I'm using Windows XP SP2

I want to make a combo work like Microsoft Word's Complex Script Fonts
Combo (Press Ctrl+D in MS Word, If you've complex script installed in
your machine, then you can see this combo.... It works like, when you
type Hindi (In our country we use Hindi instead of Devanagari,
Devanagari is an ancient word but i had to mention it before. Sorry :
( ) this combo list contains only those fonts, who have Hindi
characters in their glyph... I think this time I make myself clear..

> Start -> Control Panel -> Regional and Language Options -> Languages. Make
> sure that both check boxes in Supplemental language support are checked.
[quoted text clipped - 4 lines]
> Validate the code page conversion tables, such as 57002 and 57003 for your
> case.

I
My Settings are ok...

> If all of this is OK, post your code.

Here is my font related coding...

..................

EnumFontFamiliesEx Me.hDC, LF, AddressOf EnumFontFamProc, ByVal 0&, 0

.............

Function EnumFontFamProc(lpNLF As LOGFONT, lpNTM As NEWTEXTMETRIC,
ByVal FontType As Long, lParam As Long) As Long
   Dim FaceName As String
   'convert the returned string to Unicode
   FaceName = StrConv(lpNLF.lfFaceName, vbUnicode)

   If (lpNLF.lfPitchAndFamily = 2 And lpNLF.lfCharSet = 0) Then Call
AddItemBySort(frmMain.comFont, Left$(FaceName, InStr(FaceName,
vbNullChar) - 1))

   'continue enumeration
   EnumFontFamProc = 1
End Function

.............

But in this way, one or two english font(s) also appear in my list..

AddItemBySort - It is a private function for adding item to a combo
using sort

> > How can I load some specific fonts, like all Bengali Fonts...
>
[quoted text clipped - 7 lines]
>
> > [Sorry for my poor English]
Thorsten Albers - 19 Mar 2007 12:06 GMT
Backslash <torifat@gmail.com> schrieb im Beitrag
<1174230234.645399.233570@y66g2000hsf.googlegroups.com>...
> EnumFontFamiliesEx Me.hDC, LF, AddressOf EnumFontFamProc, ByVal 0&, 0

You should show us how LF is initialized because this specifies what
EnumFontFamiliesEx() shall do.

> Function EnumFontFamProc(lpNLF As LOGFONT, lpNTM As NEWTEXTMETRIC,
> ByVal FontType As Long, lParam As Long) As Long

It doesn't matter for your code - but you should have in mind that

a) EnumFontFamiliesEx() wants a EnumFontFamiliesExProc() and not a
EnumFontFamiliesProc(), and

b) That the first parameter of both the EnumFontFamiliesExProc() and the
EnumFontFamiliesProc() isn't a pointer to a LOGFONT structure
(EnumFontFamiliesProc(): pointer to an ENUMLOGFONT structure;
EnumFontFamiliesExProc(): pointer to an ENUMLOGFONTEX structure).

This doesn't matter for your code since both the ENUMLOGFONT and the
ENUMLOGFONTEX structure start with a LOGFONT structure, so that a pointer
to an ENUMLOGFONT/ENUMLOGFONTEX structure is also a pointer to a LOGFONT
structure.
But for a good coding style you should use the appropriate callback
procedure which is for EnumFontFamiliesEx():

Function EnumFontFamExProc _
        (
          ByVal pELFE As ENUMLOGFONTEX, _
          ByVal pNTME As NEWTEXTMETRICEX, _
          ByVal lFontType As Long,
          ByVal lParam As Long _
        ) As Long

End Funtion

>     If (lpNLF.lfPitchAndFamily = 2 And lpNLF.lfCharSet = 0) Then Call
> AddItemBySort(frmMain.comFont, Left$(FaceName, InStr(FaceName,
> vbNullChar) - 1))

This selects only those fonts of the listed ones which have

- a variable pitch
- a font-family 'don't care'
- an ANSI character set

It is very unlikely that this indeed is the selection you want - unless the
LF initialization mentioned above is already used to get a restricted
enumeration.

Signature

----------------------------------------------------------------------
THORSTEN ALBERS                       Universität Freiburg
                                               albers@
                                                      uni-freiburg.de
----------------------------------------------------------------------

Backslash - 19 Mar 2007 16:38 GMT
Thanks for your advice :) ....

I've tried with both EnumFontFamilies & EnumFontFamiliesEx and I've
two callback function in my coding... I had made the mistake when I'm
coping...

LF is nothing....

Dim LF As LOGFONT
EnumFontFamiliesEx Me.hDC, LF, AddressOf EnumFontFamProc, ByVal 0&, 0
Thorsten Albers - 19 Mar 2007 17:35 GMT
Backslash <torifat@gmail.com> schrieb im Beitrag
<1174318705.479417.192440@n59g2000hsh.googlegroups.com>...
> LF is nothing....
> Dim LF As LOGFONT
> EnumFontFamiliesEx Me.hDC, LF, AddressOf EnumFontFamProc, ByVal 0&, 0

In this case LF.lfCharset is 0 when passed to EnumFontFamiliesEx(). Since 0
is ANSI_CHARSET, only those fonts implementing the ANSI character set will
be enumerated - which possibly excludes the bengali and/or hindi fonts
which you want to be enumerated.

Signature

----------------------------------------------------------------------
THORSTEN ALBERS                       Universität Freiburg
                                               albers@
                                                      uni-freiburg.de
----------------------------------------------------------------------

Thorsten Albers - 19 Mar 2007 19:04 GMT
Thorsten Albers <albersRE@MOVEuni-freiburg.de> schrieb im Beitrag
<01c76a44$36b1f0a0$a34bf8d9@thaldesk>...
> In this case LF.lfCharset is 0 when passed to EnumFontFamiliesEx(). Since 0
> is ANSI_CHARSET, only those fonts implementing the ANSI character set will
> be enumerated - which possibly excludes the bengali and/or hindi fonts
> which you want to be enumerated.

I forgot: Set LF.lfCharset to DEFAULT_CHARSET (= 1) to enumerate all fonts.
Then select the fonts wanted either by the codepage bit or the Unicode
coderange bit in NEWTEXTMETRICEX.FONTSIGNATURE.fsCsb/.fsUsb.

Signature

----------------------------------------------------------------------
THORSTEN ALBERS                       Universität Freiburg
                                               albers@
                                                      uni-freiburg.de
----------------------------------------------------------------------

Backslash - 20 Mar 2007 14:35 GMT
Thanks bro, I'll try it and inform you later :D, thanks again
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.