You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Greg Brown <gk...@mac.com> on 2009/10/05 19:56:29 UTC
New font encoding
Hi all,
I have just finished making a change that provides much more
flexibility in customizing the appearance of text-based components.
Instead of the "fontBold", "fontItalic", and "fontSize" styles that
were previously limited to the Label skin, you can now use a new JSON-
based encoding on any component that displays text. For example, the
following markup will create a PushButton that uses a 12-point bold
font whose other attributes are taken from the theme font:
<PushButton buttonData="Foo" styles="{font:{size:12, bold:true}}"/>
All properties are optional; any unspecified properties will be taken
from the theme. The supported attributes are "name" (String),
"size" (int), "bold" (boolean), and "italic" (boolean). Note that, if
the curly braces are not included, the previous encoding that relied
on Font.decodeFont() will be used.
The down side is that you will need to update any WTKX files that were
using the previous styles, since they are no longer supported. Any
such changes should be straightforward, but please let me know if you
have any questions.
Greg
Re: New font encoding
Posted by Noel Grandin <no...@gmail.com>.
I based my suggestion on my usage of the Netbeans Form Editor
(Matisse), where I typically specify a "+1" or "+2" font to make a
heading label stand out.
But yeah, percentage would probably make more sense.
On Mon, Oct 5, 2009 at 21:29, Greg Brown <gk...@mac.com> wrote:
> That is doable, though those values would have to be specified as strings,
> since "size:+1" isn't valid JSON. But that is OK, since that makes it easier
> to handle those cases. If size is a number, it is handled as a point size.
> Otherwise, if it is a string and begins with "+" or "-", we can treat it as
> a increment or decrement value. If it ends with "%", we would treat it as a
> percentage value.
>
> On the other hand, "+1" is somewhat vague. What units would apply here? Does
> the value represent a point size? If so, then you'd still need to know
> something about the default font to know how "1" relates to it. Maybe a
> strictly relative format (such as percentage) would be better.
>
> G
>
> On Oct 5, 2009, at 3:21 PM, Noel Grandin wrote:
>
>> Hi
>>
>> Since font sizing is also generally part of the theme, is would be
>> nice to be able to specify
>>
>> styles="font:{size:+1}"
>>
>> or
>>
>> styles="font:{size:120%}"
>>
>> so that no knowledge of the theme's settings is necessary.
>>
>> Regards, Noel.
>>
>> On Mon, Oct 5, 2009 at 19:56, Greg Brown <gk...@mac.com> wrote:
>>>
>>> Hi all,
>>>
>>> I have just finished making a change that provides much more flexibility
>>> in
>>> customizing the appearance of text-based components. Instead of the
>>> "fontBold", "fontItalic", and "fontSize" styles that were previously
>>> limited
>>> to the Label skin, you can now use a new JSON-based encoding on any
>>> component that displays text. For example, the following markup will
>>> create
>>> a PushButton that uses a 12-point bold font whose other attributes are
>>> taken
>>> from the theme font:
>>>
>>> <PushButton buttonData="Foo" styles="{font:{size:12, bold:true}}"/>
>>>
>>> All properties are optional; any unspecified properties will be taken
>>> from
>>> the theme. The supported attributes are "name" (String), "size" (int),
>>> "bold" (boolean), and "italic" (boolean). Note that, if the curly braces
>>> are
>>> not included, the previous encoding that relied on Font.decodeFont() will
>>> be
>>> used.
>>>
>>> The down side is that you will need to update any WTKX files that were
>>> using
>>> the previous styles, since they are no longer supported. Any such changes
>>> should be straightforward, but please let me know if you have any
>>> questions.
>>>
>>> Greg
>>>
>>>
>
>
Re: New font encoding
Posted by Greg Brown <gk...@mac.com>.
That is doable, though those values would have to be specified as
strings, since "size:+1" isn't valid JSON. But that is OK, since that
makes it easier to handle those cases. If size is a number, it is
handled as a point size. Otherwise, if it is a string and begins with
"+" or "-", we can treat it as a increment or decrement value. If it
ends with "%", we would treat it as a percentage value.
On the other hand, "+1" is somewhat vague. What units would apply
here? Does the value represent a point size? If so, then you'd still
need to know something about the default font to know how "1" relates
to it. Maybe a strictly relative format (such as percentage) would be
better.
G
On Oct 5, 2009, at 3:21 PM, Noel Grandin wrote:
> Hi
>
> Since font sizing is also generally part of the theme, is would be
> nice to be able to specify
>
> styles="font:{size:+1}"
>
> or
>
> styles="font:{size:120%}"
>
> so that no knowledge of the theme's settings is necessary.
>
> Regards, Noel.
>
> On Mon, Oct 5, 2009 at 19:56, Greg Brown <gk...@mac.com> wrote:
>> Hi all,
>>
>> I have just finished making a change that provides much more
>> flexibility in
>> customizing the appearance of text-based components. Instead of the
>> "fontBold", "fontItalic", and "fontSize" styles that were
>> previously limited
>> to the Label skin, you can now use a new JSON-based encoding on any
>> component that displays text. For example, the following markup
>> will create
>> a PushButton that uses a 12-point bold font whose other attributes
>> are taken
>> from the theme font:
>>
>> <PushButton buttonData="Foo" styles="{font:{size:12, bold:true}}"/>
>>
>> All properties are optional; any unspecified properties will be
>> taken from
>> the theme. The supported attributes are "name" (String),
>> "size" (int),
>> "bold" (boolean), and "italic" (boolean). Note that, if the curly
>> braces are
>> not included, the previous encoding that relied on Font.decodeFont
>> () will be
>> used.
>>
>> The down side is that you will need to update any WTKX files that
>> were using
>> the previous styles, since they are no longer supported. Any such
>> changes
>> should be straightforward, but please let me know if you have any
>> questions.
>>
>> Greg
>>
>>
Re: New font encoding
Posted by Noel Grandin <no...@gmail.com>.
Hi
Since font sizing is also generally part of the theme, is would be
nice to be able to specify
styles="font:{size:+1}"
or
styles="font:{size:120%}"
so that no knowledge of the theme's settings is necessary.
Regards, Noel.
On Mon, Oct 5, 2009 at 19:56, Greg Brown <gk...@mac.com> wrote:
> Hi all,
>
> I have just finished making a change that provides much more flexibility in
> customizing the appearance of text-based components. Instead of the
> "fontBold", "fontItalic", and "fontSize" styles that were previously limited
> to the Label skin, you can now use a new JSON-based encoding on any
> component that displays text. For example, the following markup will create
> a PushButton that uses a 12-point bold font whose other attributes are taken
> from the theme font:
>
> <PushButton buttonData="Foo" styles="{font:{size:12, bold:true}}"/>
>
> All properties are optional; any unspecified properties will be taken from
> the theme. The supported attributes are "name" (String), "size" (int),
> "bold" (boolean), and "italic" (boolean). Note that, if the curly braces are
> not included, the previous encoding that relied on Font.decodeFont() will be
> used.
>
> The down side is that you will need to update any WTKX files that were using
> the previous styles, since they are no longer supported. Any such changes
> should be straightforward, but please let me know if you have any questions.
>
> Greg
>
>