"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "swindow/SFontImpl.cpp" between
yudit-3.0.5.tar.gz and yudit-3.0.7.tar.gz

About: yudit is an Unicode plain-text editor that can do True Type font rendering, printing, transliterated keyboard input and handwriting recognition with no dependencies on external engines.

SFontImpl.cpp  (yudit-3.0.5):SFontImpl.cpp  (yudit-3.0.7)
skipping to change at line 527 skipping to change at line 527
/** /**
* Try to draw one single glyph. * Try to draw one single glyph.
* @param canvas is the canvas to draw to * @param canvas is the canvas to draw to
* @param m is the conversion matrix * @param m is the conversion matrix
* @param uch is the array containing ucs4 * @param uch is the array containing ucs4
* @prama len is the length of the array * @prama len is the length of the array
* @return true is drawn. * @return true is drawn.
*/ */
bool bool
SFontImpl::draw (SCanvas* canvas, const SPen& pen, const SS_Matrix2D& m, SFontImpl::draw (SCanvas* canvas, const SPen& aPen, const SS_Matrix2D& m,
SS_UCS4 uch, bool isLRContext) SS_UCS4 uch, bool isLRContext, bool isSelected, bool baseOK)
{ {
SPen pen (aPen);
if (!delegate) return 0; if (!delegate) return 0;
SFontDelegate* d = (SFontDelegate*) delegate;; SFontDelegate* d = (SFontDelegate*) delegate;;
SS_Matrix2D sd = m * matrix; SS_Matrix2D sd = m * matrix;
switch (d->type) switch (d->type)
{ {
case SFontDelegate::SE_TTF: case SFontDelegate::SE_TTF:
if (d->u.ttf->isOK()) if (d->u.ttf->isOK())
{ {
if (!isSelected && d->u.ttf->getIsEmoji())
{
pen.setForeground (SColor("black"));
pen.setBackground (SColor("white"));
}
if (!d->u.ttf->width (m, uch, 0)) return 0; if (!d->u.ttf->width (m, uch, 0)) return 0;
long larr[8]; long larr[8];
larr[0] = 'T' ; larr[1] = 'T'; larr[2] = 'F'; larr[0] = 'T' ; larr[1] = 'T'; larr[2] = 'F';
larr[3] = (long)d->u.ttf; larr[4] = (long)uch; larr[3] = (long)d->u.ttf; larr[4] = (long)uch;
SString key((char*) larr, 5 * sizeof (long)); SString key((char*) larr, 5 * sizeof (long));
/* FIXME: you should in fact use an instance counter. */ /* FIXME: you should in fact use an instance counter. */
key.append ((long)(sd.x0*16000.0)); /* scale-x */ key.append ((long)(sd.x0*16000.0)); /* scale-x */
key.append ((long)(sd.y1*16000.0)); /* scale-y */ key.append ((long)(sd.y1*16000.0)); /* scale-y */
if (!isLRContext) key.append ("R"); if (!isLRContext) key.append ("R");
skipping to change at line 564 skipping to change at line 570
key.append ((char)fg.alpha); key.append ((char)fg.alpha);
double offsetX = 0.0; double offsetX = 0.0;
double offsetY = 0.0; double offsetY = 0.0;
/* for better positioning of diacritical marks */ /* for better positioning of diacritical marks */
d->u.ttf->getBaseOffsets (sd, uch, &offsetX, &offsetY); d->u.ttf->getBaseOffsets (sd, uch, &offsetX, &offsetY);
// No need to be part of the key // No need to be part of the key
//key.append ((long)(offsetX*16000.0)); //key.append ((long)(offsetX*16000.0));
//key.append ((long)(offsetY*16000.0)); //key.append ((long)(offsetY*16000.0));
sd.t0 += offsetX; sd.t0 += offsetX;
sd.t1 += offsetY; sd.t1 += offsetY;
//fprintf (stderr, "draw %x baseOK=%d\n", uch, (int)baseOK);
if (!isSelected && d->u.ttf->getIsEmoji() && !baseOK)
{
double width = 1.0;
#if 0
fprintf (stderr, "ascent: %g descent: %g offsetX: %g, offsetY: %g\n",
ascent(), descent(), offsetX, offsetY);
#endif
d->u.ttf->width (sd, uch, &width);
canvas->bitfill(pen.getBackground(),
(int) (m.t0), (int) (m.t1-ascent()),
(int) (width+1.0),
(int) (ascent()+descent()+1.0));
}
/* reverse coordinates Y, negative m.t1 */ /* reverse coordinates Y, negative m.t1 */
if (!canvas->beginImage (m.t0+offsetX, m.t1+offsetY, key, pen.getBackgro und())) if (!canvas->beginImage (m.t0+offsetX, m.t1+offsetY, key, pen.getBackgro und()))
{ {
// TODO: add color fonts. // TODO: add color fonts.
canvas->newpath(); canvas->newpath();
/* not cached yet */ /* not cached yet */
d->u.ttf->draw (canvas, sd, uch, isLRContext); d->u.ttf->draw (canvas, sd, uch, isLRContext);
canvas->fill (pen); canvas->fill (pen);
} }
canvas->endImage (); canvas->endImage ();
 End of changes. 4 change blocks. 
2 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)