From 0940ed88c4ad38b6d220cf337da4192556c9aca6 Mon Sep 17 00:00:00 2001 From: Scott Gilbertson Date: Tue, 10 Jun 2003 01:50:12 +0000 Subject: natFont.cc (getMaxAscent): adjusted return value. 2003-06-09 Scott Gilbertson * gnu/gcj/xlib/natFont.cc (getMaxAscent): adjusted return value. (getMaxDescent): adjusted return value. (getAscent): modified to use metrics for 'O'. (getDescent): modified to use metrics for 'y'. From-SVN: r67692 --- libjava/ChangeLog | 7 +++++++ libjava/gnu/gcj/xlib/natFont.cc | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d0b1a4d..3fdf18f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2003-06-09 Scott Gilbertson + + * gnu/gcj/xlib/natFont.cc (getMaxAscent): adjusted return value. + (getMaxDescent): adjusted return value. + (getAscent): modified to use metrics for 'O'. + (getDescent): modified to use metrics for 'y'. + 2003-06-08 Anthony Green * java/net/URLStreamHandler.java (sameFile): Fix port value diff --git a/libjava/gnu/gcj/xlib/natFont.cc b/libjava/gnu/gcj/xlib/natFont.cc index 0f8f43d..c929d22 100644 --- a/libjava/gnu/gcj/xlib/natFont.cc +++ b/libjava/gnu/gcj/xlib/natFont.cc @@ -44,25 +44,35 @@ jint gnu::gcj::xlib::Font::getXIDFromStruct(gnu::gcj::RawData* structure) jint gnu::gcj::xlib::Font::getMaxAscent() { XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->max_bounds.ascent; + return fontStruct->max_bounds.ascent+1; // +1 to include the baseline } jint gnu::gcj::xlib::Font::getMaxDescent() { XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->max_bounds.descent; + return fontStruct->max_bounds.descent-1; // -1 to exclude the baseline } jint gnu::gcj::xlib::Font::getAscent() { XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->ascent; + jint returnValue = fontStruct->ascent; + if (fontStruct->min_byte1==0 && fontStruct->min_char_or_byte2<=(unsigned)'O') + returnValue = fontStruct + ->per_char[(unsigned)'O'-fontStruct->min_char_or_byte2] + ->ascent; + return returnValue+1; // +1 to include the baseline } jint gnu::gcj::xlib::Font::getDescent() { XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->ascent; + jint returnValue = fontStruct->descent; + if (fontStruct->min_byte1==0 && fontStruct->min_char_or_byte2<=(unsigned)'y') + returnValue = fontStruct + ->per_char[(unsigned)'y'-fontStruct->min_char_or_byte2] + ->descent; + return returnValue-1; // -1 to exclude the baseline } jint gnu::gcj::xlib::Font::getStringWidth(java::lang::String* text) -- cgit v1.1