Bug 29011 - FreetypeGlyphVector.getGlyphPosition(int glyphIndex) should not throw when glyphIndex == nGlyphs
Summary: FreetypeGlyphVector.getGlyphPosition(int glyphIndex) should not throw when gl...
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: awt (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-11 04:04 UTC by Cameron McCormack
Modified: 2006-10-17 18:10 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Patch to make getGlyphPosition work as advertised. (350 bytes, patch)
2006-09-11 04:09 UTC, Cameron McCormack
Details | Diff
fix for getGlyphPosition and support for vertical fonts (1.46 KB, patch)
2006-09-19 19:08 UTC, Francis Kung
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack 2006-09-11 04:04:45 UTC
gnu.java.awt.peer.gtk.FreetypeGlyphVector.getGlyphPosition(int glyphIndex) should not throw an exception when glyphIndex is equal to the number of glyphs in the vector (see the GlyphVector javadocs).  It should instead return the position after the last glyph in the vector.
Comment 1 Cameron McCormack 2006-09-11 04:09:10 UTC
Created attachment 12219 [details]
Patch to make getGlyphPosition work as advertised.

This patch makes the glyphTransforms array bigger by one and stores the transform representing the position after the final glyph in it.  getGlyphTransform now performs an explicit check that throws if the passed glyphIndex is equal to nGlyphs.
Comment 2 Francis Kung 2006-09-19 19:08:38 UTC
Created attachment 12298 [details]
fix for getGlyphPosition and support for vertical fonts

whoops, once again I didn't check the bugzilla before working on something.  This patch takes a slightly different approach, and stores all the glyphPositions instead of storing all the transforms; it makes a bit more sense this way (instead of converting from position to transform, and back to position).  It also adds support for vertical fonts.

Do you mind if I commit this one instead?  Sorry about that!
Comment 3 Cameron McCormack 2006-09-19 22:55:55 UTC
That's ok, as long as it is fixed. :)
Comment 4 cvs-commit@developer.classpath.org 2006-09-20 18:29:53 UTC
Subject: Bug 29011

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Francis Kung <fkung>	06/09/20 18:26:24

Modified files:
	.              : ChangeLog 
	gnu/java/awt/peer/gtk: FreetypeGlyphVector.java 

Log message:
	2006-09-20  Francis Kung  <fkung@redhat.com>
	
		PR 29011
		* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java:
		(constructor): Expanded glyphPositions array to accomodate Y-coordinates.
		(getGlyphOutline): Call getGylphTransform to generate transform.
		(getGylphPosition): Read position directly out of array.
		(getGlyphPositions): Read positions directly out of array.
		(getGlyphTransform): Generate transform based on gylphPositions array.
		(performDefaultLayout): Populate glyphPositions array instead of transforms.
		(setGlyphPosition): Set position directly into array.
		(setGlyphTransform): Update positions array as well.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.8576&r2=1.8577
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java?cvsroot=classpath&r1=1.7&r2=1.8



Comment 5 cvs-commit@developer.classpath.org 2006-09-20 21:51:09 UTC
Subject: Bug 29011

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Francis Kung <fkung>	06/09/20 21:50:01

Modified files:
	.              : ChangeLog 
	gnu/java/awt/peer/gtk: FreetypeGlyphVector.java 

Log message:
	2006-09-20  Francis Kung  <fkung@redhat.com>
	
		PR 29011
		* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java:
		(getGlyphTransform): Use translation instead of scale.
		(performDefaultLayout): Increment position values instead of resetting, and
		pre-increment instead of post-increment.
		(setGlyphTransform): Handle null case with identity transform.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.8579&r2=1.8580
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java?cvsroot=classpath&r1=1.8&r2=1.9



Comment 6 Francis Kung 2006-10-17 18:10:26 UTC
fixed