Hi,

In my printer driver(user-mode), I am trying to get a character width in
logical units, same as by calling GetCharABCWidths function.

I think I should use FONTOBJ_cGetGlyphs to get GLYPHDATA information and
then calculate the character width. But the result is alway different with
the GetCharABCWidths function.

Can someone tell me it is a correct way? And how can i get the corrert result?
Plz help me, I am need of these truely very urgent to me.

Thanks!

Re: FONGOBJ_xxx,how to get a character width in logical units? by Tim

Tim
Fri Dec 30 00:03:37 CST 2005

MSX.GK <MSXGK@discussions.microsoft.com> wrote:
>
>In my printer driver(user-mode), I am trying to get a character width in
>logical units, same as by calling GetCharABCWidths function.
>
>I think I should use FONTOBJ_cGetGlyphs to get GLYPHDATA information and
>then calculate the character width. But the result is alway different with
>the GetCharABCWidths function.
>
>Can someone tell me it is a correct way? And how can i get the corrert result?
>Plz help me, I am need of these truely very urgent to me.

Why don't you show us the code that computes the size? Perhaps one of us
will spot it.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: FONGOBJ_xxx,how to get a character width in logical units? by MSX

MSX
Fri Dec 30 03:25:02 CST 2005

Thanks for your respones, here is the code segment:

LONG GetCharWidth( FONTOBJ* pfo, WCHAR wc )
{
FD_GLYPHSET *pfdg = NULL;
LONG width = 0;

pfdg = FONTOBJ_pfdg( pfo );
if ( pfdg && pfdg->cRuns > 0 )
{
ULONG i = 0;
for ( i = 0; i < pfdg->cRuns; i++ )
{
if ( wc >= pfdg->awcrun[i].wcLow && wc <= pfdg->awcrun[i].wcLow
+ pfdg->awcrun[i].cGlyphs )
{
GLYPHDATA gd= {0};
GLYPHDATA *pgd = NULL;
HGLYPH *pglyph = pfdg->awcrun[i].phg;
ULONG uIndex = wc - pfdg->awcrun[i].wcLow;
FONTOBJ_cGetGlyphs( pfo, FO_PATHOBJ, 1, &pglyph[uIndex],
(LPVOID)&pgd );

// how should i calculate the logical height here? use
(pgd->fxD / POINTSIZE), it looks like wrong ?
width = ????;

break;
}
}
}
return width;
}

please give me comment, thanks.


Re: FONGOBJ_xxx,how to get a character width in logical units? by Tim

Tim
Sat Dec 31 13:45:46 CST 2005

MSX.GK <MSX.GK@discussions.microsoft.com> wrote:

>Thanks for your respones, here is the code segment:
>
>LONG GetCharWidth( FONTOBJ* pfo, WCHAR wc )
>{
> FD_GLYPHSET *pfdg = NULL;
> LONG width = 0;
>
> pfdg = FONTOBJ_pfdg( pfo );
> if ( pfdg && pfdg->cRuns > 0 )
> {
> ULONG i = 0;
> for ( i = 0; i < pfdg->cRuns; i++ )
> {
> if ( wc >= pfdg->awcrun[i].wcLow && wc <= pfdg->awcrun[i].wcLow
>+ pfdg->awcrun[i].cGlyphs )
> {
> GLYPHDATA gd= {0};
> GLYPHDATA *pgd = NULL;
> HGLYPH *pglyph = pfdg->awcrun[i].phg;
> ULONG uIndex = wc - pfdg->awcrun[i].wcLow;
> FONTOBJ_cGetGlyphs( pfo, FO_PATHOBJ, 1, &pglyph[uIndex],
>(LPVOID)&pgd );
>
> // how should i calculate the logical height here? use
>(pgd->fxD / POINTSIZE), it looks like wrong ?
> width = ????;

In what units? The fields in GLYPHDATA have already been translated to
pixels. Remember, however, that they are in 28.4 fixed-point format. If
you just want integer pixels, use pgd->fxD >> 4.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: FONGOBJ_xxx,how to get a character width in logical units? by MSXGK

MSXGK
Mon Jan 02 01:12:01 CST 2006

Hi, Tim

I just want get the character width by design unit.
for example: a 1000 point font, get the character width by design unit.
can you please give me a formula?

Thank a lot.


Re: FONGOBJ_xxx,how to get a character width in logical units? by Tim

Tim
Mon Jan 02 17:35:48 CST 2006

MSX.GK <MSXGK@discussions.microsoft.com> wrote:
>
>I just want get the character width by design unit.
>for example: a 1000 point font, get the character width by design unit.
>can you please give me a formula?

How is that possibly useful to a device driver? Why would you care about
design units? Surely you want either points or pixels.

If you really want design units, perhaps you should just go read the .TTF
files directly.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.