Revision: 7665
Author: victormote
Date: 2006-06-16 19:10:44 -0700 (Fri, 16 Jun 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7665&view=rev
Log Message:
-----------
Conform to axsl changes: Add new methods to Font interface to provide metrics for underline, overline, and strikout positions and weights.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-06-17 01:03:08 UTC (rev 7664)
+++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-06-17 02:10:44 UTC (rev 7665)
@@ -372,4 +372,63 @@
return Constants.BASELINE_ALPHABETIC;
}
+ /**
+ * {@inheritDoc}
+ */
+ public int underlineSize(int fontSize) {
+ /* TODO: Where possible, replace this heuristic with data from the
+ * font itself. */
+ /* Until we learn better, make this the same size as the strikeout. */
+ return strikeoutSize(fontSize);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int underlinePosition(int fontSize) {
+ /* TODO: Where possible, replace this heuristic with data from the
+ * font itself. */
+ return (fontSize / 10) * -1;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int overlineSize(int fontSize) {
+ /* TODO: Where possible, replace this heuristic with data from the
+ * font itself. */
+ /* Until we learn better, make this the same size as the strikeout. */
+ return strikeoutSize(fontSize);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int overlinePosition(int fontSize) {
+ /* TODO: Where possible, replace this heuristic with data from the
+ * font itself. */
+ return getAscender(fontSize) + (fontSize / 10);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int strikeoutSize(int fontSize) {
+ /* TODO: Where possible, replace this heuristic with data from the
+ * font itself. */
+ /* This computation comes from the OpenType manual, Section OS/2
+ * table, for the definition of "yStrikeoutSize", where this ratio is
+ * suggested. */
+ return fontSize * 102 / 2048;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int strikeoutPosition(int fontSize) {
+ /* TODO: Where possible, replace this heuristic with data from the
+ * font itself. */
+ return getAscender(fontSize) * 3 / 8;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|