Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Implementing a font driver in Windows Embedded CE 6.0 R2

36 views
Skip to first unread message

JackyLiao

unread,
Apr 24, 2009, 8:01:00 AM4/24/09
to
Hello,
I want to implement a font driver, but I can't found enough documents to
start.
I have a font file with private format which is stroke-based.
And I have a standard C library to render it.
I want to implement them as a font driver that GDI(or GWES) can use.
Microsoft has released an interface for third parties to supply their font
driver.
They call it "Pluggable fonts".
http://msdn.microsoft.com/en-us/library/bb665989.aspx
I have browsed some files in %WINCEROOT%\PUBLIC\COMMON\OAK\INC, like
winddi.h, winddif.h, fontdrv.h, truetypefontdriver.hpp...,
but I still don't know how to get the entry point.

Here are my questions:
1. My environment: VS2005 SP1 + Platform Builder 6.0 SP1(Evaluation)+ PB 6.0
R2.
Is it sufficient? What else should I install?
2. In DrvEnableDriver(), the third parameter is in DRVENABLEDATA type, but
there isn't any define of DrvTextOut in winddi.h. How to let DrvTextOut be
used by GDI? Need I modify winddi.h? Also PENGCALLBACKS is in the same
situation.
3. How to let the founction pointers defined in fontdrv.h, such as
FDLOADFONTFILE(), FDQUERYFONT()..., being used? And how to use FD_INTERFACE?
4. Is a font driver in user-mode or kernel-mode? What's the difference?

Any futher suggestions are very appreciate. Thank you all very much.

JackyLiao

unread,
Apr 24, 2009, 8:05:01 AM4/24/09
to

JackyLiao

unread,
Apr 28, 2009, 3:10:01 AM4/28/09
to
Any suggestions?

Paul G. Tobey [eMVP]

unread,
Apr 28, 2009, 11:42:50 AM4/28/09
to
As far as I can recall, you're the only person who has ever mentioned doing
this since I started with Windows CE...

Paul T.

"JackyLiao" <Jack...@discussions.microsoft.com> wrote in message
news:949B51B1-F880-418A...@microsoft.com...

Paul G. Tobey [eMVP]

unread,
Apr 28, 2009, 1:26:49 PM4/28/09
to
So, continuing the discussion from the chat:

1. The MSDN help is pretty specific about which of the functions are
required for font drivers:
DrvTextOut, FDDESTROYFONT, FDGETFONTTABLE, FDLOADFONTFILE, FDQUERYFONT,
FDQUERYFONTDATA, FDQUERYFONTFILE, and FDUNLOADFONTFILE are all indicated as
required for font drivers.

2. The help for each function also seems pretty clear about what it's
supposed to do. Obviously, I'm not actually trying to build a font driver,
or use some existing library to implement one, which seems like it would be
a trick, without you actually knowing the font's format yourself, but the
documentation appears to me to be pretty clear.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:eanx1fBy...@TK2MSFTNGP05.phx.gbl...

JackyLiao

unread,
Apr 29, 2009, 2:30:01 AM4/29/09
to

Dear Paul,
Thank you very much for your attention of this question continueously.
I thought the documents were clear enough, like you, as I found the pages
the first time.
So I decided to implement a font driver for our own file format.
But, when I really implementing it, I can't figure out the relationship
between
GDI, font driver, DDI(DrvTextOut) and the set of 7 functions(FDLOADFONTFILE,
...).

I think the 7 functions are used while installing a font file into the
system, and help GDI to get a set of glyph metrics while drawing.

My question is how to let these 7 functions being uesd by GDI?
In fontdrv.h, it defines a FD_INTERFACE:
typedef struct
{
HINSTANCE library;
FDQUERYFONT pfnQueryFont;
FDQUERYFONTFILE pfnQueryFontFile;
FDQUERYFONTDATA pfnQueryFontData;
FDDESTROYFONT pfnDestroyFont;
FDLOADFONTFILE pfnLoadFontFile;
FDUNLOADFONTFILE pfnUnLoadFontFile;
FDGETFONTTABLE pfnGetFontTable;
} FD_INTERFACE, *LPFD_INTERFACE;

I think I have to set something like that:
ULONG Myfunc_LoadFontFile( .... );
FD_INTERFACE fdif;
fdif.pfnLoadFontFile = Myfunc_LoadFontFile;
....
and then return this fdif to GDI to be used.

But I don't know this should be done in which function.

Originally, I think it should be in DrvEnableDriver(),
but the definition of DrvEnableDriver() in winddi.h doesn't contain this part.
DRVENABLEDATA contains many DrvXxx() functions, but no the interface for
FD_INTERFACE.
Even DrvTextOut() are not shown in winddi.h .

So I confused of this, and read a lot of MSDN documents to figure it out.
Maybe I am a newer in this field, so I failed and come here.
Now I still don' know how to expose my implemented functions to GDI.

Could you please guide me what should I do?

Thank you very much.

JackyLiao

Paul G. Tobey [eMVP]

unread,
Apr 29, 2009, 12:20:19 PM4/29/09
to
> Dear Paul,
> Thank you very much for your attention of this question continueously.
> I thought the documents were clear enough, like you, as I found the pages
> the first time.
> So I decided to implement a font driver for our own file format.
> But, when I really implementing it, I can't figure out the relationship
> between
> GDI, font driver, DDI(DrvTextOut) and the set of 7
> functions(FDLOADFONTFILE,
> ...).
>
> I think the 7 functions are used while installing a font file into the
> system, and help GDI to get a set of glyph metrics while drawing.

Yes, this is how I read what I see while executing a stub driver. On
startup, GWES loads the registry entries to find out which extensions it
should look for as "fonts". It also loads each font rendering engine found
in the registry. For each file found with a suitable extension, it calls
the rendering engine to see a) if the engine understands the file and, b) if
so, how many type faces are in the file (and what their information is).

> My question is how to let these 7 functions being uesd by GDI?
> In fontdrv.h, it defines a FD_INTERFACE:
> typedef struct
> {
> HINSTANCE library;
> FDQUERYFONT pfnQueryFont;
> FDQUERYFONTFILE pfnQueryFontFile;
> FDQUERYFONTDATA pfnQueryFontData;
> FDDESTROYFONT pfnDestroyFont;
> FDLOADFONTFILE pfnLoadFontFile;
> FDUNLOADFONTFILE pfnUnLoadFontFile;
> FDGETFONTTABLE pfnGetFontTable;
> } FD_INTERFACE, *LPFD_INTERFACE;

Don't do anything with this. This may be how GDI keeps track of the
functions for a single engine. I don't see any reason to believe that you'd
ever need to create one of these or use one. It looks to me like GDI just
looks for exported functions from the engine DLL which have suitable names.

> Could you please guide me what should I do?

No. I don't know any more than you do and don't have any source code that
you don't have for this part of the operating system. Have you emailed
Mike? Sue sent a message, as you saw, soliciting help from someone else on
the team. This is NOT going to be a quick process. I would not expect to
have a working engine for at least a month, if I were you.

Paul T.


Paul G. Tobey [eMVP]

unread,
Apr 29, 2009, 4:51:11 PM4/29/09
to
The function names documented in the help are wrong. The easiest way to get
your engine to export the right names is to use the Dependency Viewer from
Visual Studio to open mgtt_o.dll from the flat release folder of a built
Windows CE operating system and make your functions be named in the same
way. Note that there is no FDGETFONTTABLE() equivalent, but I assume that
FntDrvQueryTrueTypeTable() is what that name in the help corresponds to in
the real engine.

As I said, I hope you're not in a hurry to get this!

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT

com> wrote in message news:eI5ajZOy...@TK2MSFTNGP06.phx.gbl...

JackyLiao

unread,
Apr 30, 2009, 2:26:06 AM4/30/09
to
Dear Paul,
I really appreciate what you've done for this question.

> > My question is how to let these 7 functions being uesd by GDI?
> > In fontdrv.h, it defines a FD_INTERFACE:
> > typedef struct
> > {
> > HINSTANCE library;
> > FDQUERYFONT pfnQueryFont;
> > FDQUERYFONTFILE pfnQueryFontFile;
> > FDQUERYFONTDATA pfnQueryFontData;
> > FDDESTROYFONT pfnDestroyFont;
> > FDLOADFONTFILE pfnLoadFontFile;
> > FDUNLOADFONTFILE pfnUnLoadFontFile;
> > FDGETFONTTABLE pfnGetFontTable;
> > } FD_INTERFACE, *LPFD_INTERFACE;
>
> Don't do anything with this. This may be how GDI keeps track of the
> functions for a single engine. I don't see any reason to believe that you'd
> ever need to create one of these or use one. It looks to me like GDI just
> looks for exported functions from the engine DLL which have suitable names.
>

Thank you very much. This note points out that I'm on a wrong way.
I am doing reseach on this direction because I have no other methods to let
GDI use my own functions. But I didn't aware that it maybe still a wrong way.

I've emailed Mike yesterday. I think he(or she) will get the mail today
because of the time zone and office time. Thank you very much to estimate the
time schedule for me. I will keep in mind.


"Paul G. Tobey [eMVP]" wrote:

JackyLiao

unread,
Apr 30, 2009, 2:56:01 AM4/30/09
to
Dear Paul,
Thank you again.
In the TrueType renderer engine that Microsoft originally built in. There is
a header file named "truetypefontdriver.hpp" in this path:
%WINCEROOT%\PUBLIC\COMMON\OAK\INC .
It defined the functions that you mentioned, such as
FntDrvQueryTrueTypeTable(), FntDrvLoadFontFile()... etc. The types &
pramaters of these functions are almost the same as FDGETFONTTABLE(),
FDLOADFONTFILE() ... etc. Do you have any idea about this?
One more thing I want to confirm is, can multiple engines exist
simultaneously in Windows CE 6.0 R2? Will GDI load my own engine while the
builtin truetype engine has been loaded already? Will GDI load my own engine
once while rebooting or being used the first time, and do not need to load
again for later use. Why I concerned with this issue is about the speed. If
GDI have to load truetype DLL and my own DLL alternatively, it will be very
slow I think.

Anyway, thank you very much.

"Paul G. Tobey [eMVP]" wrote:

Paul G. Tobey [eMVP]

unread,
Apr 30, 2009, 11:10:22 AM4/30/09
to
You're asking the wrong guy! I don't KNOW anything. I'm experimenting,
just like I expect you to be doing! If you're just sitting around reading
the docs and trying to guess about how things will work without writing any
code, building any operating systems, and seeing how things work with the
debugger, then you are not doing your part of this.

Yes, I can get my own engine loaded when the built-in True Type engine is
also loaded (it would be worthless, otherwise, and Microsoft seldom wastes
time on things like that). The documentation on MSDN is accurate in that
respect (how to get it loaded). You're worrying about speed?! If it's too
slow, then what? If you can afford NOT to have this other engine in your
OS, then LEAVE IT OUT and move on to more-productive work. In that case,
you won't have to figure out what's wrong with the documentation, what the
characteristics of the undocumented (or improperly documented), interface
is, etc.

Paul T.

"JackyLiao" <Jack...@discussions.microsoft.com> wrote in message

news:EAF1F4D1-8FBA-4E5C...@microsoft.com...

JackyLiao

unread,
May 4, 2009, 1:46:04 AM5/4/09
to
Dear Paul,
This is my first time to develope a driver in Windows CE with Platform
Builder.
I only encountered Windows (not CE even) SDK before. (software development)
So I'm still studying to get familier with Platform Builder and trying to
image the artitechture of Windows CE & GDI for a font driver.
I am not sure that everything I imaged from reading the documents are right.
I always feel that I might miss some documents out to solve my questions, or
I misundertand something because of the language.
Now, I'm still trying to finish all the functions mentioned in "Pluggable
Fonts".
I know I have a long way to go, and many things to study, such as building,
deploying, emulating, debugging, ...and etc.
I asked so many questions just want to shorten the time and get someone to
prove that I'm not on a wrong way.
What you've done really helps me a lot.

Anyway, thank you very much.

JackyLiao

0 new messages