From da88b0f2ac0b09082222ce1a387987e8cdd5f21d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 19 Feb 2023 05:12:04 +0100 Subject: Graph Font.Metrics: Use unchanges sign of (+) ascent, (-) descent and (+) lineGap, document them properly and fix Font.getLineHeightFU() --- src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 6 +----- src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/jogamp/graph/font') diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index f5358b74b..90cc725e0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -253,11 +253,7 @@ class TypecastFont implements Font { @Override public int getLineHeightFU() { final Metrics metrics = getMetrics(); - final int lineGap = metrics.getLineGapFU() ; // negative value! - final int descent = metrics.getDescentFU() ; // positive value! - final int ascent = metrics.getAscentFU() ; // negative value! - final int advanceY = lineGap - descent + ascent; // negative value! - return -advanceY; + return metrics.getAscentFU() - metrics.getDescentFU() + metrics.getLineGapFU(); } @Override diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index cae8b2755..a9fd32e9d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -65,7 +65,7 @@ final class TypecastHMetrics implements Metrics { @Override public int getAscentFU() { - return -hheaTable.getAscender(); // inverted + return hheaTable.getAscender(); } @Override @@ -75,7 +75,7 @@ final class TypecastHMetrics implements Metrics { @Override public int getDescentFU() { - return -hheaTable.getDescender(); // inverted + return hheaTable.getDescender(); } @Override @@ -85,7 +85,7 @@ final class TypecastHMetrics implements Metrics { @Override public int getLineGapFU() { - return -hheaTable.getLineGap(); // inverted + return hheaTable.getLineGap(); } @Override -- cgit v1.2.3