Graphics screens are not displayed in Windows 10 Japanese environment

Windows specific questions.
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Graphics screens are not displayed in Windows 10 Japanese environment

Postby Makoto WATANABE » Oct 09, 2020 3:51

This bug is a Microsoft Japan issue.
I have reported it to Microsoft Japan, but there is no prospect to be modified.
I would appreciate it if FreeBASIC could support it in the next version.

1. Phenomenon (fact)
In Windows10 Japanese environment, screens of "2D Drawing Functions" and "Screen Functions" program example of "FreeBASIC Manual" are not displayed.
Add the following at the beginning of the program to display the graphics screen.
(This code was given by fxm.)

Code: Select all

' Sets the graphics method GDI
SetEnviron("fbgfx=GDI")


2. Cause I imagined
Since English alphabet characters are simple, they are displayed beautifully with "GDI" ClearType, which uses only x-direction anti-aliasing.
However, Japanese characters have a large number of strokes, they are used DirectWrite of "DirectX" instead of "GDI" to improve the character display in both X and Y directions.
Due to this fundamental difference in display, I think we have to explicitly specify "fbgfx=GDI" in FreeBASIC.

P.S.
Dear Kuan Hsu;
Are graphics screens appear in Windows 10 Traditional Chinese environment?
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby Makoto WATANABE » Oct 14, 2020 6:16

I add the behavior of the programs on Windows10 Japanese.

The "Windows version" of "FBWiki:CompilerRequirements" has the following description.
"The gfx routines will use DirectX 5.0 or later if found on the host system, otherwise they'll fall back on standard Win32 GDI which will work on any Windows system."

Windows10 Japanese does not support FreeBASIC even though it has "DirectX 12".
This may be that DirectWrite for Japanese display is preventing FreeBASIC from connecting to DirectX.
Therefore, by explicitly specifying SetEnviron("fbgfx=GDI"), FreeBASIC can use GDI rather than DirectX for screen display.
(Of course, if I specify SetEnviron("fbgfx=DirectX") on Windows 10 Japanese, the screen is not displayed.)

The following are the differences in screen display between Windows 8.1 and Windows 10.
    environment\FB code .... ||Unspecified ||fbgfx=DirectX ||fbgfx=GDI
    ---------------------------------------------------------------------------------------------
    Windows8.1 Japanese ... ||displayed... ||displayed..... ||displayed
    Windows10 English mode ||displayed... ||displayed..... ||displayed
    Windows10 Japanese .... ||Don't show.. ||Don't show.... ||displayed
If FreeBASIC finds DirectX but decides that it cannot display the drawing screen, it would be nice if FreeBASIC could switch to GDI and display the screen.
dodicat
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby dodicat » Oct 14, 2020 9:22

Here 64 bits fb is always GDI (UK)
So you only have to deal with 32 bits.
To do it with minimum code (including NOT loading fbgfx.bi)

Code: Select all


#if sizeof(integer)=4 '=32 bits
screencontrol (103, "GDI") 'set driver name to GDI
#endif


screen 19
dim as string s
screencontrol (9 ,s) 'get driver name
draw string(200,200), s
sleep

 
fxm
Posts: 9913
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby fxm » Oct 14, 2020 12:09

As I wrote above, the minimum code for me is this only line:
SetEnviron("fbgfx=GDI")
compatible with -lang qb and -lang fb (32/64-bit).
adeyblue
Posts: 19
Joined: Nov 07, 2019 20:08

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby adeyblue » Oct 14, 2020 22:17

DirectX works on Windows 10 Home 64-bit Japanese here. This is the code in dodicat's post without the GDI line
https://prnt.sc/uzgiky

Without the DirectX fix for 64-bit, the same code works, just says GDI instead
https://prnt.sc/uzgwg6
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby Makoto WATANABE » Oct 15, 2020 14:10

Dear adeyblue

Thank you for taking the time to build a Japanese environment and test it.
Thanks for your exertion.
DirectX is displayed in your Japanese environment !

Unfortunately, I was not able to display DirectX on the following 7 computers that I can use.
    Model.......... ||Windows10... ||DirectX(dxdiag)
    -------------------------------------------------------------
    ThinkPad E570 ||64 Home 1909 ||DirectX 12
    T552............ ||64 Home 1909 ||DirectX 12
    ASUS V241..... ||64 Home 2004 ||DirectX 12
    ThinkPad L540 ||64 Pro... 1909 ||DirectX 12
    GLM-15......... ||64 Pro... 1909 ||DirectX 12
    T100TA......... ||32 Home 1909 ||DirectX 12
    PIPO X9........ ||32 Home 1909 ||DirectX 12
It may be that my commonly installed app is intercepting FreeBASIC.
Or maybe my favorite settings (e.g. IME settings) or something else is affecting it.
It's strange.
MrSwiss
Posts: 3599
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby MrSwiss » Oct 15, 2020 14:25

Hi Makoto,

try the latest builds of FBC 1.08.dev (WIP) from: German FreeBASIC site.
Currently last build: 2020-10-14 (WIN 32/64 and others).
They contain the latest GFX-drivers from: adeyblue, committed by coderJeff.
Please, give us feedback from those tests ...
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby Makoto WATANABE » Oct 16, 2020 4:39

Dear MrSwiss

Thank you for providing the WIP information.

I tried it, but sadly not only DirectX but also GDI SetEnviron ("fbgfx = GDI") did not show graphics screens.
I'm shedding tears ;-(
MrSwiss
Posts: 3599
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby MrSwiss » Oct 16, 2020 19:09

Makoto WATANABE wrote:I tried it, but sadly not only DirectX but also GDI SetEnviron ("fbgfx = GDI") did not show graphics screens.
This is unfortunately not precise enough explained to 'get the full picture'.
Is there none graphics 'window' at all, or is it simply 'empty'? (nothing printed)

Does the exaple you are testing run properly, when you change the 'language setting' to english?
Alternative:
Does it run with all 'Text' translated to japanese? (all string contents & literals)

Which TTFont (TT = true type) is set on your system as default?

Does below snippet run correctly? Which settings work/don't work?

Code: Select all

' GFX_Font-Test1.bas -- (c) 2020-10-16, MrSwiss
'
' compile: -s gui                       ' WIN only
'

' screen constants
Const As UShort scr_w = 800, scr_h = 600, _         ' change as needed
                mxw = scr_w - 1, mxh = scr_h - 1, _ ' don't touch (never change)
                clrd = 32, pgs = 2, sflg = 64       ' change not needed typically

' color constants (mainly self explaining)
Const As ULong  white  = &hFFFFFFFF, black  = &hFF000000, _
                dgray  = &hFF3F3F3F, mgray  = &hFF7F7F7F, _ ' d = dark | m = medium
                bgray  = &hFFBFBFBF, bred   = &hFFFF0000, _ ' b = bright   
                bgreen = &hFF00FF00, bblue  = &hFF0000FF, _
                yellow = &hFFFFFF00, orange = &hFFFF7F00, _
                violet = &hFF7F007F, cyan   = &hFF00FFFF, _
                pink   = &hFFFF00FF, transp = &h00FF00FF    ' pink | FB's magic pink

ScreenRes(scr_w, scr_h, clrd, pgs)      ' sflg not wanted here (all opaque)
ScreenSet(1, 0)                         ' working-/display-page
Color(black, white) : Cls               ' fore-/background colors
Width scr_w \ 8, scr_h \ 16             ' force: 8 x 16 Font size

For i As UInteger = 32 To 127
    If i = 127 Then
        Print WChr(i) : Exit For
    End If
    Print WChr(i); ", ";
Next

Print : Print : Print "... done ... ";
Flip                                    ' aka: pcopy (show it all)

Sleep
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby Makoto WATANABE » Oct 17, 2020 9:27

Dear MrSwiss
Thank you for committing to the drawing screen display in the Japanese environment.

Does TTFont mean the font on this screen?
It is "MS Gothic".
Image


The screenshot of the result of MrSwiss' snippet is as follows.

1. English mode (This screen is displayed instantly.)
Image


2. Japanese mode
(1) In most cases, this white window appears and then the window disappears immediately.
Image

(2) Sometimes a white screen (no response) appears and after a while the window disappears.
Image

(3) While I tried many times, only once did the same screen appear as the English screen.
Image
MrSwiss
Posts: 3599
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby MrSwiss » Oct 17, 2020 23:15

Hi Makoto,

seems it is a 'language setting' problem (by your results).
Nothing to do with FB but the combination of Language and Font used by language selected.
(Chinese, Japanese and Korean languages seem to all need Unicode capable Font(s) to run properly.)

I've found a windows setting (control panel) that you can try, as a sort of last resort.
It is located in 'Region' in the Tab 'Administrative' at the bottom half 'Language for non-Unicode programs'.
See what it currently says (to go back there if test is a failure), then switch to 'english' and repeat the tests.
Only use the latest 1.08.dev compiler for testing.

Apart from that I'm really running out of ideas ...
(The only conclusion concerning FB so far is, that the GFX-drivers are of no consequence here.)
adeyblue
Posts: 19
Joined: Nov 07, 2019 20:08

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby adeyblue » Oct 18, 2020 21:11

MrSwiss wrote:(The only conclusion concerning FB so far is, that the GFX-drivers are of no consequence here.)


Except if the GFX window disappears, it means the GFX driver thread exited, whether it was told to or it crashed. And if it doesn't get to the Sleep, it probably crashed.
Plus if the window sometimes says not responding, that means the GFX driver thread is alive (since the window is still there) but hasn't pumped messages for at least five seconds (i.e. it's gotten stuck somewhere) and a deadlock in the GFX drivers is a pretty serious problem.

Makoto, can you open Task Manager and go to the Processes tab (you may have to click More Details first), compile the code below and keep running it until it stops on the empty white screen or says Not Responding.
When it does, in Task Manager right click on the exe's entry and Create Dump File. It'll put it in your temp directory.
When that's done, if you could zip the dump file, the exe and any error.txt file together and upload it somewhere (there's https://www.filedropper.com if you don't have anywhere else)

Code: Select all

' GFX_Font-Test1.bas -- (c) 2020-10-16, MrSwiss
'' compile: -s gui                       ' WIN only
'
#include "windows.bi"
#include "crt/stdio.bi"

Function ExceptionHandler stdcall (pEp As PEXCEPTION_POINTERS) As Long

    ' Bypass FB file handling code because we don't want to try taking locks
    ' that might now be abandoned

    dim f as FILE ptr
    dim pEr as PEXCEPTION_RECORD = pEp->ExceptionRecord
    f = fopen("error.txt", "at")
    If f <> Null Then
        fprintf( _
           f, _
           "Caught exception of type %#x at %p\n", _
           pEr->ExceptionCode, pEr->ExceptionAddress _
        )
        fclose(f)
    End If

    Return 0

End Function

' screen constants
Const As UShort scr_w = 800, scr_h = 600, _         ' change as needed
                mxw = scr_w - 1, mxh = scr_h - 1, _ ' don't touch (never change)
                clrd = 32, pgs = 2, sflg = 64       ' change not needed typically

' color constants (mainly self explaining)
Const As ULong  white  = &hFFFFFFFF, black  = &hFF000000, _
                dgray  = &hFF3F3F3F, mgray  = &hFF7F7F7F, _ ' d = dark | m = medium
                bgray  = &hFFBFBFBF, bred   = &hFFFF0000, _ ' b = bright   
                bgreen = &hFF00FF00, bblue  = &hFF0000FF, _
                yellow = &hFFFFFF00, orange = &hFFFF7F00, _
                violet = &hFF7F007F, cyan   = &hFF00FFFF, _
                pink   = &hFFFF00FF, transp = &h00FF00FF    ' pink | FB's magic pink

AddVectoredExceptionHandler(1, @ExceptionHandler)

ScreenRes(scr_w, scr_h, clrd, pgs)      ' sflg not wanted here (all opaque)
ScreenSet(1, 0)                         ' working-/display-page
Color(black, white) : Cls               ' fore-/background colors
Width scr_w \ 8, scr_h \ 16             ' force: 8 x 16 Font size

For i As UInteger = 32 To 127
    If i = 127 Then
        Print WChr(i) : Exit For
    End If
    Print WChr(i); ", ";
Next

Print : Print : Print "... done ... ";
Flip                                    ' aka: pcopy (show it all)

Sleep
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Graphics screens are not displayed in Windows 10 Japanese environment

Postby Makoto WATANABE » Oct 20, 2020 4:06

Dear adeyblue
Thank you for committing to this drawing screen display in the Japanese environment.

I sent the result of running the test program.
http://makoto-watanabe.main.jp/freebasic/GFX_Font-Test.ZIP

The file names with a description of 108 are FreeBASIC1.08 WIP and the one without are FreeBASIC1.071.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 1 guest