Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 52255 invoked from network); 25 Sep 2006 15:51:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Sep 2006 15:51:04 -0000 Received: (qmail 12545 invoked by uid 500); 25 Sep 2006 15:51:00 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 12417 invoked by uid 500); 25 Sep 2006 15:51:00 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 12406 invoked by uid 99); 25 Sep 2006 15:51:00 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Sep 2006 08:51:00 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=oleg.v.khaschansky@gmail.com; spf=pass Authentication-Results: idunn.apache.osuosl.org header.from=oleg.v.khaschansky@gmail.com; domainkeys=good X-ASF-Spam-Status: No, hits=0.5 required=5.0 tests=DNS_FROM_RFC_ABUSE Received-SPF: pass (idunn.apache.osuosl.org: domain gmail.com designates 64.233.184.229 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 Received: from [64.233.184.229] ([64.233.184.229:54908] helo=wr-out-0506.google.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 81/1B-13750-2CAF7154 for ; Mon, 25 Sep 2006 08:50:27 -0700 Received: by wr-out-0506.google.com with SMTP id 58so707369wri for ; Mon, 25 Sep 2006 08:49:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Y/43wT+kPH0jE0RHWOzXm08LZCBzzi5lI4QH82DgU1azAjQSNs52bsbDU1L0CPagSptVRIhANlngbd8tmttuM89Iq6JgqzuFPsgIxcMNEz5s+j3KKfVerQAnpvobYSBmYozxUYjEND2yFjEJeqmVpmbG3iq+3uz6q11Wu4Kb5V8= Received: by 10.90.113.18 with SMTP id l18mr1494696agc; Mon, 25 Sep 2006 08:49:52 -0700 (PDT) Received: by 10.90.71.11 with HTTP; Mon, 25 Sep 2006 08:49:52 -0700 (PDT) Message-ID: <26c14c2a0609250849n7e71976che3e56ab98d92533e@mail.gmail.com> Date: Mon, 25 Sep 2006 19:49:52 +0400 From: "Oleg Khaschansky" To: harmony-dev@incubator.apache.org Subject: Re: [classlib][awt] Fonts with negative size. In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <26c14c2a0609250228k42925125me10a37317aee2a2e@mail.gmail.com> <26c14c2a0609250722s74bf5fabl3a88f2cbf62079af@mail.gmail.com> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N +1 I also think that it is better to follow 6.0 spec in this situation and to suggest that all the words said about TextAttribute are applicable to the Font itself. Actually, using default font size is definitely more reasonable behavior then playing with those negative values and the only concern was compatibility. But if 6.0 spec goes this way then, I think, we must do the same. Still there's a question what would be the metrics for the explicitely transformed font? On 9/25/06, Ilya Okomin wrote: > Guys, I found something in the Java 6.0 documentation. > If you look at the TextAttribute spec there is a note for the SIZE > field, attribute key for the font size: > > "Attribute key for the font size. Values are instances of *Number*. The > default value is 12pt. > > This corresponds to the size parameter to the Font constructor. > > Very large or small sizes will impact rendering performance, and the > rendering system might not render text at these sizes. *Negative sizes are > illegal and result in the default size*." > For this reason I suggest to use default size (12pt) if font has negative > size parameter. Any thoughts? > > I believe negative-sized fonts support was erroneous in Java 5.0 and > in the earlier versions of Java. > > Regards, > Ilya. > > > On 9/25/06, Oleg Khaschansky wrote: > > > > It seems like returning negative metrics is somewhat logical. If the > > font is rotated by -Pi then all offsets becomes negative, but their > > absolute values are equal to the positive ones. > > > > I'll try to give an example. E.g. if descent was, say, 10 and one > > needed to offset 10 pt from the origin (baseline) to the bottom of the > > black box then if -pi rotation is applied to the font, one need to > > offset -10 pt from the baseline since black box is upside down. > > > > Yes, RI failed to be consistent with this on heavyweight components as > > it was noted in the evaluation. But is this bug still there in the RI? > > And if RI is inconsistent with the drawing of negative-sized fonts it > > is still consistent with the negative metrics, right? > > > > IMHO, the ideal behavior in all situations would be the following: > > If the font has negative size we assume that it has all the same > > metrics as the positive font, but the metrics which has a direction > > (like ascent, descent, etc.) are with the different sign. The font is > > drawn as it was rotated by -pi angle. > > > > Personaly my opinion is that this is a bug, not non-bug diff. > > I'd suggest to choose between these options: > > 1. Fix metrics and rendering, close this issue. > > 2. Fix metrics, open a new jira for the rendering of the negative-sized > > fonts. > > 3. Fix nothing, open a new jira or add an evaluation to this one > > both for the rendering and for the metrics. This means that we want to > > have them together. > > > > For the rendering part, why not just add a transform if the size of > > the font is negative? > > > > On 9/25/06, Ilya Okomin wrote: > > > On 9/25/06, Oleg Khaschansky wrote: > > > > > > > It was evaluated as "not a bug". But it is clear from its evaluation > > > > that negative-sized fonts are treated as positive sized but rotated > > > > around their origin, say with implicit transform. I'd suggest to > > > > follow this behavior. > > > > > > > > > I agree, that the behavior of the negative-sized fonts on RI is looks > > like > > > the behavior of positive ones with -Pi rotation. However, if we look at > > the > > > font metrics, bounds - we can see negative values for height, width > > > values...I'm not sure they have any sence without additional > > documentation > > > that we can't find in the spec. > > > Moreover bug evaluation says that RI handles negative-sized fonts for > > > components in different ways depending on the platform. And it's > > behavior > > > unlike the drawing on the frame surface. What is to add - metrics for > > all > > > these various cases are the same, it means that RI has erroneous > > behavior in > > > some way. > > > > > > I would suggest not to follow the RI and mark it as "non-bug difference" > > as > > > the RI hasn't any clear documentation on this problem and it's > > > behavior erroneous and depends on the platform or component type. > > > > > > Thanks, > > > Ilya. > > > > > > > > > > > > > > > > On 9/23/06, Richard Liang < richard.liangyx@gmail.com> wrote: > > > > > On 9/23/06, Alexey Varlamov wrote: > > > > > > Google said this is the bug of RI in progress [1]. However there > > is no > > > > > > distinct resolution yet... > > > > > > > > > > > > > > > > It's reported again Java 1.1.8 more than 3 years agao. I don't think > > > > > RI will fix this bug. > > > > > > > > > > Richard. > > > > > > > > > > > [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4803825 > > > > > > > > > > > > > > > > > > 2006/9/23, Richard Liang < richard.liangyx@gmail.com>: > > > > > > > On 9/22/06, Ilya Okomin < ilya.okomin@gmail.com> wrote: > > > > > > > > Hi, all! > > > > > > > > > > > > > > > > I was playing with fonts and found that Font with negative > > size > > > > can be > > > > > > > > created on RI. > > > > > > > > Unfortunately spec keep silence about fonts with negative > > sizes. > > > > > > > > On Harmony if font size is negative then it is set to zero. > > > > > > > > > > > > > > > > ------------test.java--------------- > > > > > > > > import java.awt.*; > > > > > > > > import java.awt.font.FontRenderContext; > > > > > > > > > > > > > > > > public class NegativeFontTest { > > > > > > > > > > > > > > > > public static void main(String[] args) { > > > > > > > > int fontsize=-5; > > > > > > > > Font localFont = new Font("Arial", 2, fontsize); > > > > > > > > System.out.println("Size = " + localFont.getSize2D()); > > > > > > > > > > > > > > > > System.out.println("Height = " + > > localFont.getLineMetrics("", > > > > new > > > > > > > > FontRenderContext(null, false, false)).getHeight()); > > > > > > > > System.out.println("MaxCharBounds = " + > > > > localFont.getMaxCharBounds(new > > > > > > > > FontRenderContext(null, false, false))); > > > > > > > > } > > > > > > > > > > > > > > > > } > > > > > > > > ---------------------------------------- > > > > > > > > If you run this test case on RI you can see that output looks > > > > quite strange: > > > > > > > > > > > > > > > > Size = -5.0 > > > > > > > > Height = -5.7495117 > > > > > > > > MaxCharBounds = java.awt.geom.Rectangle2D$Float[x=0.0,y= > > 4.6081543 > > > > ,w=-5.46875 > > > > > > > > ,h=- 5.7495117] > > > > > > > > > > > > > > > > > > > > > > > > Actually, I dont see any sence in negative height and width > > > > metrics and > > > > > > > > I think it is an RI bug. > > > > > > > > If you try to draw text with such font on RI - nothing is > > happen, > > > > you can't > > > > > > > > see any text on the component. > > > > > > > > I've ran 'xfontsel' tool on Linux and there was suggested to > > > > choose only > > > > > > > > positive sized fonts. Also I've looked on the GDI LOGFONT > > > > structure > > > > > > > > description in MSDN and I've seen there again that we deal > > with > > > > absolute > > > > > > > > height values. > > > > > > > > > > > > > > > > Any thoughts on this issue, is it RI bug or not? > > > > > > > > > > > > > > We cannot say it's a bug of RI, because the spec does not > > explicitly > > > > > > > describe the requirement of font size. > > > > > > > > > > > > > > I suggest we follow RI. > > > > > > > > > > > > > > Best regards, > > > > > > > Richard > > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > Ilya. > > > > > > > > > > > > > > > > -- > > > > > > > > -- > > > > > > > > Ilya Okomin > > > > > > > > Intel Middleware Products Division > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Richard Liang > > > > > > > China Development Lab, IBM > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > > > > > > To unsubscribe, e-mail: > > harmony-dev-unsubscribe@incubator.apache.org > > > > > > > For additional commands, e-mail: > > > > harmony-dev-help@incubator.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > > > > > To unsubscribe, e-mail: > > harmony-dev-unsubscribe@incubator.apache.org > > > > > > For additional commands, e-mail: > > harmony-dev-help@incubator.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Richard Liang > > > > > China Development Lab, IBM > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > > > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > > > > > For additional commands, e-mail: > > harmony-dev-help@incubator.apache.org > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > > > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > > > > > > > > > > > > > > > > -- > > > -- > > > Ilya Okomin > > > Intel Middleware Products Division > > > > > > > > > > --------------------------------------------------------------------- > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > > > > > > -- > -- > Ilya Okomin > Intel Middleware Products Division > > --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org