problems loading help

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

problems loading help

Heiko Rehder
We are trying to use 7.5 on a Linux Terminal Server (NoMachine) running
OpenSuSE 10.2.

The Problem is, when I try to load the help, I got an error "primitive
failed". Tracing that error leads to an problem with an font
"adobe-helvetica-medium-r-normal--*-67-75-75-p-*-iso8859-1",
it seems that the font is not installed on the System or something like
that.

Did anyone encounter problems like this, and solved them ??

Thanks,
Heiko

Reply | Threaded
Open this post in threaded view
|

Re: problems loading help

Martin McClure
Heiko Rehder wrote:

> We are trying to use 7.5 on a Linux Terminal Server (NoMachine) running
> OpenSuSE 10.2.
>
> The Problem is, when I try to load the help, I got an error "primitive
> failed". Tracing that error leads to an problem with an font
> "adobe-helvetica-medium-r-normal--*-67-75-75-p-*-iso8859-1",
> it seems that the font is not installed on the System or something like
> that.
>
> Did anyone encounter problems like this, and solved them ??

I recently saw this problem. I haven't solved it.

Regards,

-Martin

Reply | Threaded
Open this post in threaded view
|

RE: problems loading help

Steven Kelly
In reply to this post by Heiko Rehder
From: Heiko Rehder [mailto:[hidden email]]
> "primitive failed" ... with an font
> "adobe-helvetica-medium-r-normal--*-67-75-75-p-*-iso8859-1",

Maybe this is a familiar problem from earlier VW versions, in which case
the solution may be running "xset fp rehash" in a terminal in your X
session. Can also be added in VW startup script. See
http://www.metacase.com/support/40/program/#gnomefontpath

We've also seen problems with VW requesting too small a font in earlier
versions, where the workaround was the "goodSize" stuff below (our fix
to 741).

Please let the list know if these help or not,
Steve

!Graphics.XFont class methodsFor: 'private'!

generateFontNameFor: prototypeName using: newSize
        "Turn one of X11R5's scalable font names into a real font name"
        "XFont generateFontNameFor:
'-linotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-1' using: 24"
        "XFont generateFontNameFor:
'-linotype-times-medium-r-normal--0-0-100-100-p-0-iso8859-1' using: 24"

        | realName prototype hyphenCount c scale resX resY goodSize |
        realName := String new writeStream.
        prototype := prototypeName readStream.
        hyphenCount := 0.
        [hyphenCount = 7]
                whileFalse:
                        [realName nextPut: (c := prototype next).
                        c = $- ifTrue: [hyphenCount := hyphenCount +
1]].
        "Starting with the pixel size field, skip over '0-0-0-0' and
fill in the values for a concrete font."
        scale := Screen default resolution.
        (prototype through: $-) = '0-'
                ifFalse: [self error: (#errExpected0Pixel <<
#dialogs >> 'Expected 0 pixel size in font name')].
        (prototype through: $-) = '0-'
                ifFalse: [self error: (#errExpected0Point <<
#dialogs >> 'Expected 0 point size in font name')].
        (resX := prototype through: $-) = '0-'
                ifFalse: [resX := Number readFrom: resX
readStream.
                                scale := resX @ scale y].
        (resY := prototype through: $-) = '0-'
                ifFalse: [resY := Number readFrom: resY
readStream.
                                scale := scale x @ resY].
        goodSize := (newSize * 72 * 10 / scale y) rounded.
        goodSize := goodSize max: 8. "Asking for 7 decipoints or below
for a scalable (bitmap?) font (e.g. 100dpi fonts) gives a primitive
failed, even after xset fp rehash. Such fonts are in the font path on
old SUSE (but not 10.1, which lists them with the :unscaled qualifier)
and on Ubuntu 6.10. They show the same difference between xlsfonts -fn
(finds the font name) and xlsfonts -l -fn (cannot instantiate the font)
as in https://launchpad.net/ubuntu/+bug/52163"
        realName
                nextPutAll: '*-';
                print: goodSize; nextPut: $-;
                print: scale x rounded; nextPut: $-;
                print: scale y rounded;
                nextPut: $-;
                nextPut: prototype next.
        (prototype next: 3) = '-0-'
                ifFalse: [self error: (#errNonScalingFont <<
#dialogs >>'This font name appears not to be scalable')].
        realName
                nextPutAll: '-*-';
                nextPutAll: prototype upToEnd.
        ^realName contents! !

 

Reply | Threaded
Open this post in threaded view
|

Re: problems loading help

Heiko Rehder
Unfortunately this does not help.

But the System is running KDE, and I think the "xset fp rehash" is
mainly for gnome-Desktops

But in the meantime we figured out that the problem can be solved, when
the help is loaded from the local desktop and not from the remote one.

I don't know why the help is not loading the first time from the remote
Desktop but when it's loaded once it will work just fine.

Thanks for all

Heiko



Steven Kelly schrieb:

> From: Heiko Rehder [mailto:[hidden email]]
>  
>> "primitive failed" ... with an font
>> "adobe-helvetica-medium-r-normal--*-67-75-75-p-*-iso8859-1",
>>    
>
> Maybe this is a familiar problem from earlier VW versions, in which case
> the solution may be running "xset fp rehash" in a terminal in your X
> session. Can also be added in VW startup script. See
> http://www.metacase.com/support/40/program/#gnomefontpath
>
> We've also seen problems with VW requesting too small a font in earlier
> versions, where the workaround was the "goodSize" stuff below (our fix
> to 741).
>
> Please let the list know if these help or not,
> Steve
>
> !Graphics.XFont class methodsFor: 'private'!
>
> generateFontNameFor: prototypeName using: newSize
> "Turn one of X11R5's scalable font names into a real font name"
> "XFont generateFontNameFor:
> '-linotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-1' using: 24"
> "XFont generateFontNameFor:
> '-linotype-times-medium-r-normal--0-0-100-100-p-0-iso8859-1' using: 24"
>
> | realName prototype hyphenCount c scale resX resY goodSize |
> realName := String new writeStream.
> prototype := prototypeName readStream.
> hyphenCount := 0.
> [hyphenCount = 7]
> whileFalse:
> [realName nextPut: (c := prototype next).
> c = $- ifTrue: [hyphenCount := hyphenCount +
> 1]].
> "Starting with the pixel size field, skip over '0-0-0-0' and
> fill in the values for a concrete font."
> scale := Screen default resolution.
> (prototype through: $-) = '0-'
> ifFalse: [self error: (#errExpected0Pixel <<
> #dialogs >> 'Expected 0 pixel size in font name')].
> (prototype through: $-) = '0-'
> ifFalse: [self error: (#errExpected0Point <<
> #dialogs >> 'Expected 0 point size in font name')].
> (resX := prototype through: $-) = '0-'
> ifFalse: [resX := Number readFrom: resX
> readStream.
> scale := resX @ scale y].
> (resY := prototype through: $-) = '0-'
> ifFalse: [resY := Number readFrom: resY
> readStream.
> scale := scale x @ resY].
> goodSize := (newSize * 72 * 10 / scale y) rounded.
> goodSize := goodSize max: 8. "Asking for 7 decipoints or below
> for a scalable (bitmap?) font (e.g. 100dpi fonts) gives a primitive
> failed, even after xset fp rehash. Such fonts are in the font path on
> old SUSE (but not 10.1, which lists them with the :unscaled qualifier)
> and on Ubuntu 6.10. They show the same difference between xlsfonts -fn
> (finds the font name) and xlsfonts -l -fn (cannot instantiate the font)
> as in https://launchpad.net/ubuntu/+bug/52163"
> realName
> nextPutAll: '*-';
> print: goodSize; nextPut: $-;
> print: scale x rounded; nextPut: $-;
> print: scale y rounded;
> nextPut: $-;
> nextPut: prototype next.
> (prototype next: 3) = '-0-'
> ifFalse: [self error: (#errNonScalingFont <<
> #dialogs >>'This font name appears not to be scalable')].
> realName
> nextPutAll: '-*-';
> nextPutAll: prototype upToEnd.
> ^realName contents! !
>
>  
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: problems loading help

Joachim Geidel
In reply to this post by Heiko Rehder
Heiko Rehder schrieb am 21.05.2007 11:14:
> We are trying to use 7.5 on a Linux Terminal Server (NoMachine) running
> OpenSuSE 10.2.
>
> The Problem is, when I try to load the help, I got an error "primitive
> failed". Tracing that error leads to an problem with an font
> "adobe-helvetica-medium-r-normal--*-67-75-75-p-*-iso8859-1",
> it seems that the font is not installed on the System or something like
> that.

We have encountered this kind of primitive failure in
Screen>>primAllocateFontNamed: on Windows 2000 when other applications
were installed while VisualWorks was running, typically office
applications or Lotus Notes which come with their own fonts. It has
probably a different cause than the error you encountered, but I wish
this problem of not being able to allocate a font would be fixed. It's
been around for a long time, caused all kinds of trouble on Linux, and
it's easy to fix.

We changed FontPolicy>>findFont: by adding an exception handler which
answers the FontPolicy's defaultFont when the primitive fails. As font
lookup does not guarantee that you get the font which you asked for, it
is okay to catch the error and answer a default font. The exception
handler could be more elaborated if there's a need for it. It could e.g.
look for a different font which more closely matches the one which could
not be allocated. However, this would be overkill in most cases.

Unfortunately, you will have to change both the package Graphics-Fonts
and the package ExtraEmphases (which most of us will have loaded in the
development environment), as findFont: is overridden in ExtraEmphases.
The patches are attached.

Wouldn't it make sense to integrate ExtraEmphases into the base image?
It's a bad thing to have an override of a system method in the
development environment which isn't there in the runtime - you never
test what will actually be deployed, and it makes debugging more
difficult than it should be.

Best regards,
Joachim Geidel

<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.5 of 16. April 2007 on 26. Mai 2007 at 9:25:11</time-stamp>


<methods>
<class-id>Graphics.FontPolicy</class-id> <category>utilities</category>

<body package="ExtraEmphases" selector="findFont:">findFont: aFontDescription
        "Answer the nearest font from those available on this device
        to the requested FontDescription"

        | font bestMatch |
        fdCache = aFontDescription ifTrue: [^dfCache].
        font := fontCache at: aFontDescription ifAbsent: [nil].
        font == nil
                ifFalse:
                        [fdCache := aFontDescription copy.
                        dfCache := font.
                        ^font].
        bestMatch := self findBestFont: aFontDescription.

        "Changed: Added an exception handler to guard against failed allocation of fonts."
        font :=
                        [aFontDescription isComposite
                                ifTrue:
                                        [CompositeFont
                                                createFont: bestMatch
                                                toResemble: aFontDescription
                                                for: self]
                                ifFalse:
                                        [fontClass
                                                createFont: bestMatch
                                                toResemble: aFontDescription
                                                on: device]]
                                        on: Error
                                        do:
                                                [:error |
                                                "The primitive in Screen&gt;&gt;primAllocateFontNamed: failed - answer a default font instead."
                                                self defaultFont].

        font := self decorateFont: font with: aFontDescription.
        fontCache at: aFontDescription copy put: font.
        fdCache := aFontDescription.
        dfCache := font.
        ^font</body>
</methods>

</st-source>

<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.5 of 16. April 2007 on 26. Mai 2007 at 9:22:22</time-stamp>


<methods>
<class-id>Graphics.FontPolicy</class-id> <category>utilities</category>

<body package="ExtraEmphases" selector="findFont:">findFont: aFontDescription
        "Answer the nearest font from those available on this device
        to the requested FontDescription"

        | font bestMatch |
        fdCache = aFontDescription ifTrue: [^dfCache].
        font := fontCache at: aFontDescription ifAbsent: [nil].
        font == nil
                ifFalse:
                        [fdCache := aFontDescription copy.
                        dfCache := font.
                        ^font].
        bestMatch := self findBestFont: aFontDescription.

        "Changed: Added an exception handler to guard against failed allocation of fonts."
        font :=
                        [aFontDescription isComposite
                                ifTrue:
                                        [CompositeFont
                                                createFont: bestMatch
                                                toResemble: aFontDescription
                                                for: self]
                                ifFalse:
                                        [fontClass
                                                createFont: bestMatch
                                                toResemble: aFontDescription
                                                on: device]]
                                        on: Error
                                        do:
                                                [:error |
                                                "The primitive in Screen&gt;&gt;primAllocateFontNamed: failed - answer a default font instead."
                                                self defaultFont].

        aFontDescription underline == true
                ifTrue: [font := font withUnderline].
        aFontDescription strikeout == true
                ifTrue: [font := font withStrikeout].
        aFontDescription color == nil
                ifFalse: [font := font withColor: aFontDescription color].
        fontCache at: aFontDescription copy put: font.
        fdCache := aFontDescription.
        dfCache := font.
        ^font</body>
</methods>

</st-source>