Fonts in VW7.4.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fonts in VW7.4.1

BREITH Karl-Albert (AREVA)
Fonts in VW7.4.1

I am using the following method to determine a font:
bounds: the view's bounds
width: the width of my text that should fit into the bounds calculated on default font (12 pixel).
…..
        dPixelSize := (style characterAttributes defaultQueryFor: nil) pixelSize.
        width := width max: 1.
        pixelSize := ((dPixelSize * ((bounds extent x - 2) / width)
                                min: (bounds extent y - count - 2) / count) * style scalingFactor)
                                asInteger.
        cStyle := VariableCharacterAttributes newWithDefaultAttributes.
        cStyle setDefaultQuery: ((FontDescription new)
                                family: #('*');
                                manufacturer: #('*');
                                fixedWidth: false;
                                serif: false;
                                italic: false;
                                boldness: 0.5;
                                pixelSize: pixelSize).
        cStyle noScaling.
        style := TextAttributes new.
        style setCharacterAttributes: cStyle.
        style
                lineGrid: pixelSize + 1;
                baseline: pixelSize.
(ComposedText withText: 'Hallo' asText allBold style: style) inspect.

The result surprises me:
Having a calculated pixelSize of 8, the text results in bigger characters than having a pixelSize of 9.

Has anyone an idea why that could be the case ?

Karl

__________________________________________________________
Karl Breith
AREVA NP GmbH
Methods & Codes (FDEEC-G)

Freyeslebenstraße 1
91058 Erlangen
Phone:   +49 (0) 9131 18-97393 
Fax:     +49 (0) 9131 18-94045         
mail to:  [hidden email]
An AREVA and Siemens company
 
Vorsitzender des Aufsichtsrats: Bertrand Durrande - Geschäftsführer: Dr. Ralf Güldner, Rüdiger Steuerlein
Sitz der Gesellschaft: Erlangen - Registergericht: Fürth, HRB 7817 -
www.areva-np.com
 
Wichtiger Hinweis: Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse, bzw. sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

 
Important Note: This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

Reply | Threaded
Open this post in threaded view
|

RE: Fonts in VW7.4.1

Steven Kelly
Fonts in VW7.4.1

Quick guess, without testing: you're using VariableCharacterAttributes, the size of which can change according to the platform and/or Locale. Try using plain CharacterAttributes.

 

Steve

 

-----Original Message-----
From: BREITH Karl-Albert FDEEC (AREVA NP GmbH) [mailto:[hidden email]]
Sent: 20. huhtikuuta 2007 14:56
To: VWNC,
Subject: Fonts in VW7.4.1

 

 

I am using the following method to determine a font:
bounds: the view's bounds
width: the width of my text that should fit into the bounds calculated on default font (12 pixel).
…..
        dPixelSize := (style characterAttributes defaultQueryFor: nil) pixelSize.
        width := width max: 1.
        pixelSize := ((dPixelSize * ((bounds extent x - 2) / width)
                                min: (bounds extent y - count - 2) / count) * style scalingFactor)
                                asInteger.
        cStyle := VariableCharacterAttributes newWithDefaultAttributes.
        cStyle setDefaultQuery: ((FontDescription new)
                                family: #('*');
                                manufacturer: #('*');
                                fixedWidth: false;
                                serif: false;
                                italic: false;
                                boldness: 0.5;
                                pixelSize: pixelSize).
        cStyle noScaling.
        style := TextAttributes new.
        style setCharacterAttributes: cStyle.
        style
                lineGrid: pixelSize + 1;
                baseline: pixelSize.
(ComposedText withText: 'Hallo' asText allBold style: style) inspect.

The result surprises me:
Having a calculated pixelSize of 8, the text results in bigger characters than having a pixelSize of 9.

Has anyone an idea why that could be the case ?

Karl

__________________________________________________________
Karl Breith
AREVA NP GmbH
Methods & Codes (FDEEC-G)

Freyeslebenstraße 1
91058 Erlangen
Phone:   +49 (0) 9131 18-97393 
Fax:     +49 (0) 9131 18-94045         
mail to:  [hidden email]
An AREVA and Siemens company
 
Vorsitzender des Aufsichtsrats: Bertrand Durrande - Geschäftsführer: Dr. Ralf Güldner, Rüdiger Steuerlein
Sitz der Gesellschaft: Erlangen - Registergericht: Fürth, HRB 7817 -
www.areva-np.com
 
Wichtiger Hinweis: Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse, bzw. sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

 
Important Note: This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

Reply | Threaded
Open this post in threaded view
|

Re: Fonts in VW7.4.1

Holger Kleinsorgen-4
In reply to this post by BREITH Karl-Albert (AREVA)
BREITH Karl-Albert FDEEC (AREVA NP GmbH) wrote:
> I am using the following method to determine a font:
> bounds: the view's bounds
>...
> The result surprises me:
> Having a calculated pixelSize of 8, the text results in bigger characters than having a pixelSize of 9.

note:

1. the font lookup searches for a best match for the font description,
which does not necessarily have the requested size
(see #measureDistancesFrom:to:stopAt:)

2. I don't know if it has been fixed, but "Screen default resolution"
always returns 75dpi on Windows plattforms, even though the default
resolution is 96 dpi (and is also adjustable).

in the Open Repository there's also a package named "Font-Lookup" which
seems to fix some issues, I haven't used it yet though.

Reply | Threaded
Open this post in threaded view
|

AW: Fonts in VW7.4.1

BREITH Karl-Albert (AREVA)
In reply to this post by Steven Kelly
Fonts in VW7.4.1
 
I have got some ideas form the VWNC group. Thanks a lot.
I am going to try which idea works best for me.
e.g. on Windows XP the fonts work fine, on Linux and HP
not. And yes, I am using VariableCharacterAttributes.
 
Karl

__________________________________________________________
Karl Breith
AREVA NP GmbH
Methods & Codes (FDEEC-G)

Freyeslebenstraße 1
91058 Erlangen
Phone:   +49 (0) 9131 18-97393 
Fax:     +49 (0) 9131 18-94045         
mail to:  [hidden email]
An AREVA and Siemens company
 
Vorsitzender des Aufsichtsrats: Bertrand Durrande - Geschäftsführer: Dr. Ralf Güldner, Rüdiger Steuerlein
Sitz der Gesellschaft: Erlangen - Registergericht: Fürth, HRB 7817 -
www.areva-np.com
 
Wichtiger Hinweis: Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse, bzw. sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.


Important Note: This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.