"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "swindow/SFont.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.

SFont.cpp  (yudit-3.0.5):SFont.cpp  (yudit-3.0.7)
skipping to change at line 87 skipping to change at line 87
"TCRCYoutsoUnicode.ttf:tibt," "TCRCYoutsoUnicode.ttf:tibt,"
"raghu.ttf:deva," "raghu.ttf:deva,"
"mangal.ttf:deva,tunga.ttf:knda,code2000.ttf:taml," "mangal.ttf:deva,tunga.ttf:knda,code2000.ttf:taml,"
"raavi.ttf:guru,shruti.ttf:gujr," "raavi.ttf:guru,shruti.ttf:gujr,"
"arialuni.ttf,cyberbit.ttf," "arialuni.ttf,cyberbit.ttf,"
"code2000.ttf,code2001.ttf:unicode:RL,arial.ttf," "code2000.ttf,code2001.ttf:unicode:RL,arial.ttf,"
//"rovasSMP.ttf," // Hosszu Gabor //"rovasSMP.ttf," // Hosszu Gabor
//"oldhunSMP.ttf," // Michael Everson //"oldhunSMP.ttf," // Michael Everson
"OldHungarian.ttf," "OldHungarian.ttf,"
"OldHungarian_Full.ttf," "OldHungarian_Full.ttf,"
"yudit.ttf" "yudit.ttf,"
"EmojiOneColor.otf:emoji,"
"TwitterColorEmoji-SVGinOT.ttf:emoji"
); );
SFontImplVector list; SFontImplVector list;
for (unsigned int i=0; i<m.size(); i++) for (unsigned int i=0; i<m.size(); i++)
{ {
/* encoding is optional */ /* encoding is optional */
SStringVector v(m[i], ":", false); SStringVector v(m[i], ":", false);
SString enc = v[0]; SString enc = v[0];
if (v.size()>1 && v[1].size()!=0) enc = v[1]; if (v.size()>1 && v[1].size()!=0) enc = v[1];
skipping to change at line 277 skipping to change at line 279
* @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
*/ */
void void
SFont::draw (SCanvas* canvas, const SPen& pen, const SS_Matrix2D& m, SFont::draw (SCanvas* canvas, const SPen& pen, const SS_Matrix2D& m,
const SGlyph& glyph) const SGlyph& glyph)
{ {
double currw = 0.0; double currw = 0.0;
bool isSelected = glyph.selected;
if (glyph.isSpecial()) if (glyph.isSpecial())
{ {
SS_Matrix2D sd; SS_Matrix2D sd;
double sc = fallbackFont.scale(); double sc = fallbackFont.scale();
sd.scale (fallbackScale * sc, fallbackScale * sc); sd.scale (fallbackScale * sc, fallbackScale * sc);
sd.translate (0, -fontDescent); sd.translate (0, -fontDescent);
SS_Matrix2D sm = m * sd; SS_Matrix2D sm = m * sd;
SFontFB::SIGN sig = mapFB (glyph); SFontFB::SIGN sig = mapFB (glyph);
/* The markers are not mirrored. */ /* The markers are not mirrored. */
if (!glyph.isLR() && sig != SFontFB::LRM && sig != SFontFB::RLM) if (!glyph.isLR() && sig != SFontFB::LRM && sig != SFontFB::RLM)
skipping to change at line 351 skipping to change at line 354
|| scriptcode == SD_ROVASIRAS || scriptcode == SD_PUA_ROVAS) || scriptcode == SD_ROVASIRAS || scriptcode == SD_PUA_ROVAS)
{ {
/* Try to use lr and rl attributes. This is the non-mirrored dwaring. */ /* Try to use lr and rl attributes. This is the non-mirrored dwaring. */
for (i=0; i<fontVector.size(); i++) for (i=0; i<fontVector.size(); i++)
{ {
SFontImpl im = fontVector[i]; SFontImpl im = fontVector[i];
// Skip cases where font is strongly the opposite direction. // Skip cases where font is strongly the opposite direction.
if (im.needSoftMirror (comp, glyph.isLR())) continue; if (im.needSoftMirror (comp, glyph.isLR())) continue;
/* this is for better positioning of diacritical marks. */ /* this is for better positioning of diacritical marks. */
if (im.draw (canvas, pen, m, comp, glyph.isLR())) if (im.draw (canvas, pen, m, comp, glyph.isLR(), isSelected, baseOK))
{ {
im.width (comp, &baseWidth); im.width (comp, &baseWidth);
baseOK=true; baseOK=true;
break; break;
} }
} }
SS_Matrix2D mm = m; SS_Matrix2D mm = m;
/* Try to mirror it - we drew neutrals and same directions */ /* Try to mirror it - we drew neutrals and same directions */
if (!baseOK) for (i=0; i<fontVector.size(); i++) if (!baseOK) for (i=0; i<fontVector.size(); i++)
{ {
SFontImpl im = fontVector[i]; SFontImpl im = fontVector[i];
bool used = im.width (comp, &currw); bool used = im.width (comp, &currw);
if (used) if (used)
{ {
/* Mirrorring can be done only if we render on our own. */ /* Mirrorring can be done only if we render on our own. */
mm.x0 = -m.x0; /* try to indicate mirroring */ mm.x0 = -m.x0; /* try to indicate mirroring */
if (im.isTTF()) if (im.isTTF())
{ {
mm.t0 = m.t0 + currw; mm.t0 = m.t0 + currw;
} }
im.draw (canvas, pen, mm, comp, glyph.isLR()); im.draw (canvas, pen, mm, comp, glyph.isLR(), isSelected, baseOK);
baseWidth = currw; baseWidth = currw;
baseOK = true; baseOK = true;
break; break;
} }
currw = 0.0; currw = 0.0;
} }
// Try ligatures composed with ZWJ // Try ligatures composed with ZWJ
// commented out as this is done in im for OldHUngarian and OldItalic // commented out as this is done in im for OldHUngarian and OldItalic
#if 0 #if 0
if (false && !baseOK && comp > 0x7fffffff) { if (false && !baseOK && comp > 0x7fffffff) {
skipping to change at line 435 skipping to change at line 438
} }
} }
#endif #endif
} }
else else
{ {
/* Try all fonts on it */ /* Try all fonts on it */
for (i=0; i<fontVector.size(); i++) for (i=0; i<fontVector.size(); i++)
{ {
SFontImpl im = fontVector[i]; SFontImpl im = fontVector[i];
if (im.draw (canvas, pen, m, comp, glyph.isLR())) if (im.draw (canvas, pen, m, comp, glyph.isLR(), isSelected, baseOK))
{ {
im.width (comp, &baseWidth); im.width (comp, &baseWidth);
baseOK = true; baseOK = true;
break; break;
} }
} }
} }
} }
/* /*
skipping to change at line 457 skipping to change at line 460
*/ */
if (!baseOK && glyph.getShapeArray()!=0 && glyph.currentShape == 0)// ISOLATED if (!baseOK && glyph.getShapeArray()!=0 && glyph.currentShape == 0)// ISOLATED
{ {
SS_UCS4 orig = glyph.getChar(); SS_UCS4 orig = glyph.getChar();
if (orig!=comp && orig != 0) if (orig!=comp && orig != 0)
{ {
setBase (orig); setBase (orig);
for (unsigned int i=0; i<fontVector.size(); i++) for (unsigned int i=0; i<fontVector.size(); i++)
{ {
SFontImpl im = fontVector[i]; SFontImpl im = fontVector[i];
if (im.draw (canvas, pen, m, orig, glyph.isLR())) if (im.draw (canvas, pen, m, orig, glyph.isLR(), isSelected, baseOK))
{ {
im.width (orig, &baseWidth); im.width (orig, &baseWidth);
baseOK = true; baseOK = true;
break; break;
} }
} }
} }
} }
/* Try precompositions */ /* Try precompositions */
skipping to change at line 629 skipping to change at line 632
sd.scale (fallbackScale * sc, fallbackScale * sc); sd.scale (fallbackScale * sc, fallbackScale * sc);
sd.translate (0, -fontDescent); sd.translate (0, -fontDescent);
SS_Matrix2D sm = m * sd; SS_Matrix2D sm = m * sd;
sm.translate (translatex, (double)0.0); sm.translate (translatex, (double)0.0);
fallbackFont.draw(canvas, pen, sm, decomp[i]); fallbackFont.draw(canvas, pen, sm, decomp[i]);
} }
else else
{ {
mo.translate (translatex, (double)0.0); mo.translate (translatex, (double)0.0);
SFontImpl im = fontVector[indeces[i]]; SFontImpl im = fontVector[indeces[i]];
im.draw (canvas, pen, mo, decomp[i], glyph.isLR()); im.draw (canvas, pen, mo, decomp[i], glyph.isLR(), isSelected, baseOK)
;
// SGC
baseOK = true;
} }
} }
} }
delete[] positions; delete[] positions;
delete[] indeces; delete[] indeces;
if (found) if (found)
{ {
baseOK = true; baseOK = true;
/* combining marks are not part of fallback */ /* combining marks are not part of fallback */
if (fbs==0) ligclust.clear(); if (fbs==0) ligclust.clear();
skipping to change at line 656 skipping to change at line 661
*/ */
if (!baseOK && glyph.getShapeArray()!=0 && glyph.currentShape != 0) //ISOLATED if (!baseOK && glyph.getShapeArray()!=0 && glyph.currentShape != 0) //ISOLATED
{ {
SS_UCS4 orig = glyph.getChar(); SS_UCS4 orig = glyph.getChar();
if (orig!=comp && orig != 0) if (orig!=comp && orig != 0)
{ {
setBase (orig); setBase (orig);
for (unsigned int i=0; i<fontVector.size(); i++) for (unsigned int i=0; i<fontVector.size(); i++)
{ {
SFontImpl im = fontVector[i]; SFontImpl im = fontVector[i];
if (im.draw (canvas, pen, m, orig, glyph.isLR())) if (im.draw (canvas, pen, m, orig, glyph.isLR(), isSelected, baseOK))
{ {
im.width (orig, &baseWidth); im.width (orig, &baseWidth);
baseOK = true; baseOK = true;
break; break;
} }
} }
} }
} }
/* Add extra composing characters as overstrike - if possible */ /* Add extra composing characters as overstrike - if possible */
skipping to change at line 713 skipping to change at line 718
/* This trick works only if ligature has two base characters */ /* This trick works only if ligature has two base characters */
else if (i<postcomp && (im.isTTF() || fbs != 0)) else if (i<postcomp && (im.isTTF() || fbs != 0))
{ {
/* RL: move it more to the end */ /* RL: move it more to the end */
if ((decomp[i] >= 0x500 && decomp[i] < 0x900)) if ((decomp[i] >= 0x500 && decomp[i] < 0x900))
{ {
mc.t0 = m.t0 + baseWidth / 2; mc.t0 = m.t0 + baseWidth / 2;
} }
} }
/* Draw it finally... */ /* Draw it finally... */
if (im.draw (canvas, pen, mc, decomp[i], glyph.isLR())) if (im.draw (canvas, pen, mc, decomp[i], glyph.isLR(), isSelected, baseO K))
{ {
break; break;
} }
} }
} }
/* return anyway. /* return anyway.
Extra composing failures will not be indicated for now. There is one Extra composing failures will not be indicated for now. There is one
for sure when you apply the composing to a cluster */ for sure when you apply the composing to a cluster */
return; return;
 End of changes. 9 change blocks. 
8 lines changed or deleted 14 lines changed or added

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