summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2008-05-31 17:20:02 +0000
committerJucaBlues <JucaBlues@users.sourceforge.net>2008-05-31 17:20:02 +0000
commit5e5fcdb602325add3f270c9e286edf903e88b425 (patch)
tree71e9ff5698296ac5cfd1c32b6fad79caf97496ba /src
parentAdded the French students that implemented LPE Stacking, the Envelope LPE, an... (diff)
downloadinkscape-5e5fcdb602325add3f270c9e286edf903e88b425.tar.gz
inkscape-5e5fcdb602325add3f270c9e286edf903e88b425.zip
* started implementing rendering of SVGFonts horizontal kerning
(bzr r5773)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-svgfonts.cpp16
-rw-r--r--src/display/nr-svgfonts.h1
2 files changed, 14 insertions, 3 deletions
diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp
index 6550daaf0..b444ce368 100644
--- a/src/display/nr-svgfonts.cpp
+++ b/src/display/nr-svgfonts.cpp
@@ -141,15 +141,25 @@ SvgFont::scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
*glyphs = (cairo_glyph_t*) malloc(count*sizeof(cairo_glyph_t));
-
+ char* previous_unicode = NULL;
count=0;
+ double x=0;
_utf8 = (char*) utf8;
while(_utf8[0] != '\0'){
len = 0;
for (i=0; i < (unsigned long) this->glyphs.size(); i++){
if ( len = compare_them(this->glyphs[i]->unicode, _utf8) ){
+ for(SPObject* node = this->font->children;previous_unicode && node;node=node->next){
+ if (SP_IS_HKERN(node)){
+ if ( (((SPHkern*)node)->u1[0] == previous_unicode[0]) && (((SPHkern*)node)->u2[0] == this->glyphs[i]->unicode[0]))//TODO: strings
+ x -= (((SPHkern*)node)->k / this->font->horiz_adv_x);
+ //g_warning("k=%f, adv_x=%f, hkerning=%f", (SPHkern*)node)->k, this->font->horiz_adv_x, hkerning);
+ g_warning("x=%f",x);
+ }
+ }
+ previous_unicode = this->glyphs[i]->unicode;
(*glyphs)[count].index = i;
- (*glyphs)[count].x = count; //TODO
+ (*glyphs)[count].x = x++; //TODO
(*glyphs)[count++].y = 0; //TODO
_utf8+=len;
continue;
@@ -157,7 +167,7 @@ SvgFont::scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
}
if (!len){
(*glyphs)[count].index = i;
- (*glyphs)[count].x = count; //TODO
+ (*glyphs)[count].x = x++; //TODO
(*glyphs)[count++].y = 0; //TODO
_utf8++;
}
diff --git a/src/display/nr-svgfonts.h b/src/display/nr-svgfonts.h
index a0cc56ccd..fc4a2b94e 100644
--- a/src/display/nr-svgfonts.h
+++ b/src/display/nr-svgfonts.h
@@ -26,6 +26,7 @@
#include "../sp-glyph.h"
#include "../sp-missing-glyph.h"
#include "../sp-font.h"
+#include "../sp-glyph-kerning.h"
class SvgFont;