LB Booster
General >> General Board >> A problem with font under LBB302
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1442514918

A problem with font under LBB302
Post by SarmedNafi on Sep 17th, 2015, 6:35pm

Dear Richard,

It is two fonts I used
The first is MS_Sans_Serif I use it because LB can not display correct Arabic on graphic box with any other font including Arial.
The second font is Arial which is preferable in Arabic, we see it's advantage for the first time under MS Access.
It was work using Arial font under all versions of LBB but LBB302!
Now LBB302 display static texts and text inside text boxes with MS_Sans_Serif font or some font similar. More over it is not possible to change it's size.
That is very bad dear Richard, Now for me the GUI is broken.
Please fix that as soon as possible.

You fix the problem of main win when I forgot it open. Thank you very much. But I surprise with font problem, I goes back to LBB300 and keep using it.

All the best and thank you.
Sarmed


Re: A problem with font under LBB302
Post by Richard Russell on Sep 17th, 2015, 7:44pm

on Sep 17th, 2015, 6:35pm, SarmedNafi wrote:
Now LBB302 display static texts and text inside text boxes with MS_Sans_Serif font or some font similar. More over it is not possible to change it's size.

I cannot reproduce that here. This program appears to run correctly in LBB v3.02:

Code:
    statictext #w.st1, "Static text1", 20, 20, 200, 30
    statictext #w.st2, "Static text2", 20, 70, 200, 30
    statictext #w.st3, "Static text3", 20, 120, 200, 40
    textbox #w.tb, 20, 170, 200, 30
    open "Font test" for window as #w
    #w.st1 "!font Courier_New 16"
    #w.st2 "!font Arial 18 italic"
    #w.st3 "!font Times_New_Roman 20 underscore"
    #w.tb  "!font Lucida_Console 16 bold"
    #w.tb  "Text Box"
    wait 

If you believe there is a problem with fonts in v3.02 please post a program that demonstrates it.

Richard.

Re: A problem with font under LBB302
Post by tsh73 on Sep 18th, 2015, 08:12am

>> please post a program that demonstrates it.

better with screenshots so one could see the problem even if it doesn't reproduce on his computer.
Re: A problem with font under LBB302
Post by tsh73 on Sep 18th, 2015, 12:43pm

Code:
#w "!font Arial 18 italic"
 

It looks like "!" is extra bit?
EDIT
JB barks at extra "!"
LBB 3.01 ignores it, changes font as required
LBB 3.02 ignores it, leaves font default (something small, not italic - like arial 9)
Re: A problem with font under LBB302
Post by SarmedNafi on Sep 18th, 2015, 1:03pm

If you tell me how to post picture? That will be better than else.

User Image
Re: A problem with font under LBB302
Post by tsh73 on Sep 18th, 2015, 1:39pm

Quote:
If you tell me how to post picture?

You post image somewhere
like
http://postimage.org/
or
http://tinypic.com/
(I just googled "free image post")
I took last one:
And post URL here, between ING tags
Code:
[IMG]http://i61.tinypic.com/ddt6t.jpg[/IMG] 

So finally you got
User Image
Re: A problem with font under LBB302
Post by Richard Russell on Sep 18th, 2015, 3:55pm

Sarmed's problem happens only under the following circumstances:
  1. You set the font of all the controls in a window/dialog by sending a FONT command to the parent window.

  2. You change the font of one or more individual controls, by sending a FONT command to that control.
What happens in that case is that when you change the font in the individual control the old font used by that control is deleted - that is the change I made in 3.02 to fix the resource leak. But in the above specific circumstance that font is shared by other controls, so when it is deleted they will not display correctly.

It is perfectly safe to do 1. on its own (set the font of all the controls) and it is perfectly safe to do 2. on its own (set the font of one or more individual controls) but if you do both in the same window the problem will arise.

The only way to 'fix' this behaviour would be for LBB to know - when the font of an individual control is changed - whether the old font is shared by other controls (in which case it should not be deleted) or not (in which case it should be deleted). But I know of no straightforward way it can make that determination. sad

The workaround is not to mix changing the font of all controls with changing the font of individual controls, but to do only one or the other.

Richard.
Re: A problem with font under LBB302
Post by SarmedNafi on Sep 18th, 2015, 9:37pm

> - that is the change I made in 3.02 to fix the resource leak.

Thank you for what you did to fix the resource leak.

Now I have to release more than hundred and fifty font statement only for child window.

> old font used by that control is deleted
I think it is more fair if the deletion done if no other control used that font.

I can't imagine I have to inter all this quantity of statements for both parent and child windows.

you know what Richard? you kill my moral ...

Please please, reconsider this modification.

Sarmed
Re: A problem with font under LBB302
Post by SarmedNafi on Sep 18th, 2015, 9:48pm

Arabic different than Latin letters.
If they became small it became hard to read.
Then we must use Tahoma for small controls or some other like that used with newspapers.

To whom should I go?

To Stefan, Rod, or Alyce ... this game has only one programmer.
Re: A problem with font under LBB302
Post by SarmedNafi on Sep 18th, 2015, 9:54pm

Anatoly,

Thanks for the cat, indeed.
Thank you very much.

Regards,
Sarmed
Re: A problem with font under LBB302
Post by Richard Russell on Sep 18th, 2015, 11:09pm

on Sep 18th, 2015, 9:37pm, SarmedNafi wrote:
Please please, reconsider this modification.

You mean restore the resource leak? That is out of the question. The program which was posted here to demonstrate the leak was using up thousands of font handles every few seconds - left to run for any length of time it would have crashed Windows!

You say you need to add 150 font statements, but why can't you use a loop? For example this should set the font in the textboxes comprising your main grid:

Code:
    for row = 1 to 15
      for col = 1 to 9
        handle$ = "#C.";row*10+col
        #handle$ "!font Arial 11 bold"
      next col
    next row 

Richard.
Re: A problem with font under LBB302
Post by SarmedNafi on Sep 19th, 2015, 04:40am

> You mean restore the resource leak?

No, Richard

I don't say that.
But give the user the ability to delete the unused font like what we did with BMP.
Or there is a check box option either we delete it manually or let LBB do it automatically (the default). In that case we win the compatibility with LB and the best performance of LBB. With some little notes on help file.
I hardly hope you will reconsider this matter.

Regards,
Sarmed
Re: A problem with font under LBB302
Post by Richard Russell on Sep 19th, 2015, 07:18am

on Sep 19th, 2015, 04:40am, SarmedNafi wrote:
Or there is a check box option either we delete it manually or let LBB do it automatically (the default).

Unfortunately the internal architecture of LBB means that making it a user-selected option is not practical (the code involved is in the LBLIB emulator library not the compiler).

However I think I have worked out how to check the font handle against all the other child controls, to determine if it should be deleted or not, so if that works it should be a full solution.

Richard.
Re: A problem with font under LBB302
Post by Rod on Sep 19th, 2015, 9:08pm

What happens if arial is set as the default font. Can that be done in preferences and then only exceptions need set?
Re: A problem with font under LBB302
Post by Richard Russell on Sep 19th, 2015, 9:38pm

on Sep 19th, 2015, 9:08pm, Rod wrote:
What happens if arial is set as the default font. Can that be done in preferences and then only exceptions need set?

I've hopefully fixed the issue reported by Sarmed in LBB v3.03. When you send a FONT command to a child control this version checks whether the 'old' font is currently in use by any of its sibling controls, and only deletes it if not.

So for example if a window has two child controls, and you set the font of both by sending a FONT command to the parent window, changing the font of just one control will not result in the old font being deleted, but subsequently changing the font of the other control will.

Achieving this is a little messy, and will make the FONT command somewhat slower, but normally that won't matter.

Richard.