Re: OpenType Patches



At 09:07 AM 9/6/2002, Owen Taylor wrote:
Since taking all the intermediate glyphs into account shouldn't be
hard, I'd rather we did that then count on all the intermediate
widths being zero.

Done.


> > > +           glyphs->glyphs[i].geometry.x_offset +=
> > PANGO_UNITS_26_6(x_pos) - x_adj;
> > > + glyphs->glyphs[i].geometry.y_offset += PANGO_UNITS_26_6(y_pos);
> > >
> > > -           for (j = i - outgpos[i].back; j < i; j++)
> > > -             glyphs->glyphs[i].geometry.x_offset -=
> > glyphs->glyphs[j].geometry.width;
> > > -
> > >             if (outgpos[i].new_advance)
> > >               /* Can't set new x offset for marks, so just make
> > sure not to increase it.
> > >                  Can do better than this by playing with ->x_offset. */
> > > -             glyphs->glyphs[i].geometry.width = 0;
> > > +             glyphs->glyphs[i].geometry.width  =
> > PANGO_UNITS_26_6(outgpos[i].x_advance);
> >
> >Do you understand the FIXME here? I don't, really. The comment applies
> >to the '= 0', so it certainly isn't literally relevant with your changes.
> >
> > >             else
> > >               glyphs->glyphs[i].geometry.width +=
> > PANGO_UNITS_26_6(outgpos[i].x_advance);
> > >           }
>
> No, I don't understand the comment here. I was tempted to remove it,
> but figured I should leave it in case someone else knows what it
> means. My understanding of the new_advance flag is that it means that
> x_advance is a new advance width rather than an adjustment to the
> existing advance width. (This is done because it makes some of the
> GPOS calculations a bit simpler)

Lets just kill the comment then; an inaccurate comment is worse than
no comment.

Done. Patch is enclosed.

Regards,
                                        Owen

Regards,
Eric
Index: pango-ot-ruleset.c
===================================================================
RCS file: /cvs/gnome/pango/pango/opentype/pango-ot-ruleset.c,v
retrieving revision 1.4
diff -u -p -r1.4 pango-ot-ruleset.c
--- pango-ot-ruleset.c	7 May 2002 20:38:50 -0000	1.4
+++ pango-ot-ruleset.c	6 Sep 2002 22:56:13 -0000
@@ -247,18 +247,26 @@ pango_ot_ruleset_shape (PangoOTRuleset  
 	{
 	  for (i = 0; i < result_string->length; i++)
 	    {
+	      FT_Pos x_pos = outgpos[i].x_pos;
+	      FT_Pos y_pos = outgpos[i].y_pos;
+	      int back = i;
 	      int j;
 
-	      glyphs->glyphs[i].geometry.x_offset += PANGO_UNITS_26_6 (outgpos[i].x_pos);
-	      glyphs->glyphs[i].geometry.y_offset += PANGO_UNITS_26_6 (outgpos[i].y_pos);
+	      while (outgpos[back].back != 0)
+		{
+		  back  -= outgpos[back].back;
+		  x_pos += outgpos[back].x_pos;
+		  y_pos += outgpos[back].y_pos;
+		}
+
+	      for (j = back; j < i; j += 1)
+	        glyphs->glyphs[i].geometry.x_offset -= glyphs->glyphs[j].geometry.width;
+
+	      glyphs->glyphs[i].geometry.x_offset += PANGO_UNITS_26_6(x_pos);
+	      glyphs->glyphs[i].geometry.y_offset += PANGO_UNITS_26_6(y_pos);
 
-	      for (j = i - outgpos[i].back; j < i; j++)
-		glyphs->glyphs[i].geometry.x_offset -= glyphs->glyphs[j].geometry.width;
-	    
 	      if (outgpos[i].new_advance)
-		/* Can't set new x offset for marks, so just make sure not to increase it.
-		   Can do better than this by playing with ->x_offset. */
-		glyphs->glyphs[i].geometry.width = 0;
+		glyphs->glyphs[i].geometry.width  = PANGO_UNITS_26_6(outgpos[i].x_advance);
 	      else
 		glyphs->glyphs[i].geometry.width += PANGO_UNITS_26_6(outgpos[i].x_advance);
 	    }
@@ -272,7 +280,6 @@ pango_ot_ruleset_shape (PangoOTRuleset  
   last_cluster = -1;
   for (i = 0; i < result_string->length; i++)
     {
-      glyphs->glyphs[i].glyph = result_string->string[i];
       glyphs->glyphs[i].glyph = result_string->string[i];
 
       glyphs->log_clusters[i] = result_string->logClusters[i];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]