[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/org/nongnu/libvob/util ScalableFont.java
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] libvob/org/nongnu/libvob/util ScalableFont.java |
Date: |
Sun, 30 Mar 2003 14:55:21 -0500 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Benja Fallenstein <address@hidden> 03/03/30 14:55:21
Modified files:
org/nongnu/libvob/util: ScalableFont.java
Log message:
Debug statements chasing a Kaffe bug. Result: 1.0f == 0.0f in Kaffe :-(
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/util/ScalableFont.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: libvob/org/nongnu/libvob/util/ScalableFont.java
diff -u libvob/org/nongnu/libvob/util/ScalableFont.java:1.1
libvob/org/nongnu/libvob/util/ScalableFont.java:1.2
--- libvob/org/nongnu/libvob/util/ScalableFont.java:1.1 Sun Mar 9 08:13:14 2003
+++ libvob/org/nongnu/libvob/util/ScalableFont.java Sun Mar 30 14:55:21 2003
@@ -38,9 +38,9 @@
*/
public final class ScalableFont {
- public static final String rcsid = "$Id: ScalableFont.java,v 1.1
2003/03/09 13:13:14 tjl Exp $";
+ public static final String rcsid = "$Id: ScalableFont.java,v 1.2
2003/03/30 19:55:21 benja Exp $";
public static boolean dbg=false;
- private static final void p(String s) { if(dbg) System.out.println(s); }
+ private static final void p(String s) { System.out.println(s); }
/** If set, font metrics will not be cached.
*/
@@ -84,6 +84,9 @@
}
FontMetrics getFontMetrics(int pt) {
+ if(pt < 0)
+ throw new IllegalArgumentException("Negative point size: "+pt);
+
if(dontCache) return fmComp.getFontMetrics(getFont(pt));
if(metrics.length <= pt) {
@@ -143,6 +146,9 @@
* @return May not return null.
*/
public FontMetrics getFontMetrics(float scale) {
+ if(scale < 0)
+ throw new IllegalArgumentException("Negative scale: "+scale);
+
if(scale == lastFMScale) return lastFM;
int pt=scale2pt(scale);
FontMetrics fm = myCache.getFontMetrics(pt);
@@ -158,8 +164,13 @@
*/
public float getScale(float height) {
float start = 1f;
- while (getFontMetrics(start).getHeight() < height) start += 1f;
+ if (dbg) p("Start with start: "+start+" height:
"+getFontMetrics(start).getHeight());
+ while (getFontMetrics(start).getHeight() < height) {
+ if (dbg) p("Increment start, was: "+start);
+ start += 1f;
+ }
if (dbg) p("Intended height: " + height);
+ if (dbg) p("Start: "+start);
if (dbg) p("Seeking area from " + (start-1f) + " (height: " +
getFontMetrics(start-1f).getHeight() + ") to " + start + "
(height: " +
getFontMetrics(start).getHeight() + ")");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob/org/nongnu/libvob/util ScalableFont.java,
Benja Fallenstein <=