Re: GDI does not provide all GLYPH handles for big font size



"fussa",

Here is a more complete code snippet that works for larger fonts.
By the way, if the font gets even bigger (say 150 pts), DrvTextOut() is no
longer called by the GDI. Instead, DrvFillPath() is called.

I am currently trying to solve this problem, since I get no font output in
this
case. Any help from anyone out there would be welcome.;

Mark

BOOL APIENTRY DrvTextOut(
SURFOBJ *pso,
STROBJ *pstro,
FONTOBJ *pfo,
CLIPOBJ *pco,
RECTL *prclExtra,
RECTL *prclOpaque,
BRUSHOBJ *pboFore,
BRUSHOBJ *pboOpaque,
POINTL *pptlBrushOrg,
MIX mix
)

.........

//Coming into DrvTextOut(), pstro->pgp can be NULL for large Fonts
//So you need to do this
if (pstro->pgp) // got the GLYPHPOS array, it's already all there
{
pgpos = pstro->pgp;
MoreGlyphs = FALSE;
cGlyphs = pstro->cGlyphs;
VERBOSE(("--DrvTextOut: pstro->pgp is NOT NULL."));
}
else // Need to do more work to get the GLYPHS
{
STROBJ_vEnumStart(pstro);
MoreGlyphs = TRUE;
VERBOSE(("--DrvTextOut: pstro->pgp is NULL, using new code"));
}

......

//
// Now start drawing the glyphs, if we have MoreGlyphs = TRUE then we
// will do a STROBJ_bEnum first, in order to load up the Glyph data.
do
{
//
// We need to enum for more glyph data so do it now.
//

if (MoreGlyphs)
{
MoreGlyphs = STROBJ_bEnum(pstro, &cGlyphs, &pgpos);

if (MoreGlyphs == DDI_ERROR)
{
VERBOSE(("DrvTextOut: STROBJ_bEnum()=DDI_ERROR"));
return(FALSE);
}
}

// loop thru array of glyph info
for( gpInd = 0; gpInd < cGlyphs; gpInd++, pgpos++ )
{
GLYPHDATA gd;
GLYPHDATA *pgd; // pointer to glyph data

VERBOSE(("--DrvTextOut: Doing Glyph # %d", gpInd));

// If GCAPS_HIGHRESTEXT is set in DEVINFO, offset is actually
// in FIX coordinates, and needs to be converted
offset.x = pgpos->ptl.x;
offset.y = pgpos->ptl.y;

if (pfo)
{
//
// This is true type font, so query the bitmap
//
pgd = &gd;

count = FONTOBJ_cGetGlyphs( pfo, FO_GLYPHBITS, 1, &pgpos->hg,
(LPVOID)&pgd );

if (count == 1)
{
pgb = pgd->gdf.pgb;
}
}
else
{
count = 1;
pgb = pgpos->pgdf->pgb; // For bitmap font, we already have the bitmap
}

if (count == 1)
{
int x, y;
int pos;
int bitpos;
BYTE set;
COLOR24 *pPixel;
int bitMask; // for checking pixels in 1 bpp glyph bitmap

//Keep running total of boundary of text string
bound.top = min( bound.top, offset.y + pgb->ptlOrigin.y + 1 );
bound.left = min( bound.left, offset.x + pgb->ptlOrigin.x );
bound.bottom = max( bound.bottom, offset.y + pgb->ptlOrigin.y + 1 +
pgb->sizlBitmap.cy );
bound.right = max( bound.right, offset.x + pgb->ptlOrigin.x +
pgb->sizlBitmap.cx );

//Can Process pixels in raster font if desired
for( y = 0; y < pgb->sizlBitmap.cy; y++ )
{
pPixel = (COLOR24*)((BYTE*)pso->pvScan0 + // the scan line
( y + offset.y + pgb->ptlOrigin.y + 1) * pso->lDelta);

x = offset.x + pgb->ptlOrigin.x; // surface position

for( bitpos = 0; bitpos < pgb->sizlBitmap.cx; bitpos++ )
{
bitMask = 1 << ( 0x000007 ^ ( bitpos & 0x000007 ));

if(((BYTE)pgb->aj[pos]) & bitMask)
{
// copy first 3 (lower order) bytes to the surface pixel
memcpy( &pPixel[x], &color, 3 );
}
x++; // next pixel on surface

if( bitMask == 1 ) // last bit of this byte
{
pos++;
}
}

if( bitMask != 1 ) // if I didn't just move to next byte...
{
pos++; // do it now, b/c rest of this byte is padding
}

}
} // printing raster glyph
else
{
VERBOSE(("-- FONTOBJ_cGetGlyphs (bitmap) FAILED"));
return(FALSE);
}

} // loop through glyphs

} while (MoreGlyphs);


"fussa" <mailbox.AF@xxxxxx> wrote in message
news:%23jfBrpJ5FHA.3188@xxxxxxxxxxxxxxxxxxxxxxx
> Hello,
>
> I have a problem to obtain all glyphs to a STROBJ if the fontsize is to
> big, for instance size 96 in Word. I only get the first glyph. If I take
> a smaler font size like 12 all handles to glyphs can be accessed.
>
> Can someone of you help me? It would be very pleasefull.
>
> I try to obtain it by using the following code:
>
> STROBJ_vEnumStart(pstro);
> do {
> bMore = STROBJ_bEnum(pstro, &cGlyphs, &pgp);
> for (i=0 ; (UINT)i < cGlyphs; i++) {
> ...
> }
> } where ( bMore );


.



Relevant Pages

  • Re: extract text from PDF file
    ... Ken> the glyphname has a matching ASCII character. ... In an attempt to obfuscate a PDF file, I have tried reencoding a font. ... It must be the glyph ...
    (comp.lang.postscript)
  • Re: extract text from PDF file
    ... Ken> reliable method is to OCR the document. ... e.g. the glyph metrics may already be ... I don't think there's anything that will deal with a PDF file, extract ... the font outlines and use those, no, but I could be wrong. ...
    (comp.lang.postscript)
  • =?iso-8859-1?q?Re:_Problem_in_char_"_=AE_"?=
    ... computer, when you edit a file in a text editor, it shows up ... it might be a font issue because if one computer is editing using ... if the codepage doesn't map properly but it's something to be aware of. ... instead of the glyph you're trying to encode. ...
    (comp.lang.c)
  • Re: Missing characters/unusable font in Word 2004
    ... character number of a glyph is by its position in the table. ... very small font that contains few glyphs, so several of those positions are ... we're only interested in its Unicode value. ...
    (microsoft.public.mac.office.word)