issue-#33 adding platform detection for wine, Windows 7, 8

Merged to the master branch

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Ivan Denisov » Thu Mar 26, 2015 7:32 pm

bernhard wrote:A bitmap might be a solution, but how does this scale with font size?
I mean not a bitmap but simple Ports drawing, it can be easily scaled with font size. It can be very accurate if use only 90 & 45 degrees. I made some demo of folds without fonts viewtopic.php?f=40&t=197#p1965
that is not beautiful yet, but I will work for it looks similar to habitual arrows if we decide to go this way. Decreasing dependencies (in this case from OS fonts) is always good for cross-platform framework. Now in Linux folds look a bit ugly because of fonts dependency :)
linux_folds.png
linux_folds.png (8.73 KiB) Viewed 12461 times
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Josef Templ » Fri Mar 27, 2015 6:30 am

▶closed fold◀
▷open fold◁

What about these?
The above characters are standard Unicode characters 25b6, 25b7, 25c0, 25c1.
Although they are standard Unicode characters, not every Windows font contains them.
My Windows Vista has these in the fonts "Arial Unicode MS", "Lucida Sans Unicode" and "DeJavu Sans".
I am not sure if every Windows version has these fonts installed and if Wine has one of them.

Drawing explicitly would be an option if somebody does the programming.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Josef Templ » Fri Mar 27, 2015 6:57 am

bernhard wrote:
that we should not add Wine detection


hmm, no, I do not object against Wine detection, but we should carefully think when using it in some "higher" level modules, i.e. outside Kernel, subsystem Host, and so on ...

Also as far as I understand Ivan, the error/bug occurs also in a russian Windows. So it might also occur in asian or other non-latin script Windows. But that is (at least for me) very difficult to check.

A bitmap might be a solution, but how does this scale with font size?
--
Bernhard


BB always had platform detection (see Dialog.platform). We should not change this
but we should of course avoid platform dependent code whenever possible.
Wine detection gives the user (everybody inside and outside the BB center)
full information for the exceptional case when it is needed.
We are providing a general purpose tool and don't know every possible use case.

So, I think platform detection including wine detection is a must.
If we can avoid or reduce its usage within the BB distribution, it would be nice.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Ivan Denisov » Fri Mar 27, 2015 7:02 am

Josef Templ wrote:▶closed fold◀
▷open fold◁

What about these?
The above characters are standard Unicode characters 25b6, 25b7, 25c0, 25c1.
Although they are standard Unicode characters, not every Windows font contains them.
My Windows Vista has these in the fonts "Arial Unicode MS", "Lucida Sans Unicode" and "DeJavu Sans".
I am not sure if every Windows version has these fonts installed and if Wine has one of them.

Drawing explicitly would be an option if somebody does the programming.


I like this arrows. For sure I can repeat this drawing with Ports DrawPath procedure. I will prepare programming soon.

The question is, that if we not using fonts, we should not add this extra procedures to Dialog, because is such case them do not solve any problem (it is disappearing). If this procedures will be available in documentation, people will use them more and it is not pleasant future :)

That is why I am suggesting to make some voting:

1. We should adopt drawing of folds and links arrows without using of any fonts.
2. We should keep drawing as it is with some platform hacks if fonts are absent.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Josef Templ » Fri Mar 27, 2015 9:49 am

I did some experiments with explicitly drawing the fold arrows.
It looks ugly. Why?

Because you don't get the subpixel antialiasing of the font rendering engine.
In other words: if you draw a 45 degree line, you see the steps at every line.
When using fonts, the font rendering engine is smart enough to draw at a subpixel level
by utilizing the fact that a color display has three subpixels (red, green, blue) per logical pixel.

I am not sure if it is possible to use the antialiasing in explicit drawings, i.e when using
DrawPath. I have not seen such an option anywhere. If it is not possible, we must forget
the idea of explicitly drawing the arrows.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Josef Templ » Fri Mar 27, 2015 11:40 am

Ivan Denisov wrote:During this discussion some clear view has come, that we should not add Wine detection, but draw folds without using Font.


And what about Ivan's observation that there is a problem with corrupted open files under wine?
It may also need a special treatment of BB when running under wine.
No matter how this will be resolved, there can always be a situation that needs
a special treatment under wine. In order to be prepared we have to provide this
information even if we find clever ways to work around such problems in
the BB center distribution.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Zinn » Fri Mar 27, 2015 4:49 pm

I prefer to use fonts instead of paint the symbols. Fonts can be changed easily.
Ivan found the font solution for folds and Gérard fond the font solution for links.
Both I have running on my computer and it looks very pretty.
This solution will be available with the next CPC edition.

Here there ar the missing link solution:
Code: Select all
...
      NEW(d); dir := d; stdDir := d;
      IF Dialog.IsLinux() OR Dialog.IsWine() THEN
         iconFont := "Liberation Mono";
         font := Fonts.dir.This(iconFont, 10*Fonts.point (*arbitrary*), {}, Fonts.normal);
         IF font.IsAlien() THEN DefaultAppearance
         ELSE
            linkLeft[0] := 02192X; linkLeft[1] := 0X; linkRight[0] := 02190X; linkRight[1] := 0X;  (* "→" "←" *)
            targetLeft[0] := 025CFX; targetLeft[1] := 0X; targetRight[0] := 025CFX; targetRight[1] := 0X; (* "●" "●" *)
            coloredBackg := FALSE
         END
      ELSIF Dialog.IsWindows() THEN
         iconFont := "Wingdings";
         font := Fonts.dir.This(iconFont, 10*Fonts.point (*arbitrary*), {}, Fonts.normal);
         IF font.IsAlien() THEN DefaultAppearance
         ELSE
            linkLeft[0] := 0F0F6X; linkLeft[1] := 0X; linkRight[0] := 0F0F5X; linkRight[1] := 0X;  (* "" "" *)
            targetLeft[0] := 0F0A4X; targetLeft[1] := 0X; targetRight[0] := 0F0A1X; targetRight[1] := 0X; (* "" "" *)
            coloredBackg := FALSE
         END
      ELSIF Dialog.IsMac() THEN
         DefaultAppearance
      ELSE
         DefaultAppearance
      END;
      NEW(cleaner);
      dialog.close.SetResources("#Std:links")
...

As you can see above: The font displays correctly in the Linux/Wine solution. The Windings font doesn't display correct.

What I'm not understand is: Why the Russian user needs a leading F0 in the Wingdings definition for the correct display?

The Wine detection is used internally only and works. Why should we throw it away?
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Ivan Denisov » Fri Mar 27, 2015 5:28 pm

Josef Templ wrote:I did some experiments with explicitly drawing the fold arrows.
It looks ugly. Why?

Because you don't get the subpixel antialiasing of the font rendering engine.
In other words: if you draw a 45 degree line, you see the steps at every line.
When using fonts, the font rendering engine is smart enough to draw at a subpixel level
by utilizing the fact that a color display has three subpixels (red, green, blue) per logical pixel.

I am not sure if it is possible to use the antialiasing in explicit drawings, i.e when using
DrawPath. I have not seen such an option anywhere. If it is not possible, we must forget
the idea of explicitly drawing the arrows.


I found some fast anti-aliasing solution for our case, please take a look:
viewtopic.php?f=40&t=197&p=1978#p1978
I mixing colour with background and draw extra path close to inclined lines.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Ivan Denisov » Fri Mar 27, 2015 5:32 pm

Josef Templ wrote:And what about Ivan's observation that there is a problem with corrupted open files under wine?
It may also need a special treatment of BB when running under wine.
No matter how this will be resolved, there can always be a situation that needs
a special treatment under wine. In order to be prepared we have to provide this
information even if we find clever ways to work around such problems in
the BB center distribution.

While we do not need this Wine detection, I do not see the reason for adding this feature now... To add is easier than remove later.
We should not add the features if they are not solving any problem now.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#33 adding platform detection for wine, Windows 7,

Postby Ivan Denisov » Fri Mar 27, 2015 5:49 pm

Zinn wrote:The Wine detection is used internally only and works. Why should we throw it away?

The simple answer is we should not make "quasiHost layer" growing.
First my suggestion was simply copy your WineHook with less changes, but the discussion here brought some more clean perspectives. To decrease dependency from the platform beyond Host modules is good trend.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Previous

Return to Resolved (Features)

Who is online

Users browsing this forum: No registered users and 1 guest

cron