LoadImageFont on OSX & Linux

Started by Yellownakji, April 24, 2019, 08:35:46

Previous topic - Next topic

Derron

#15
Use an OTG cable and connect a simple usb hub ... connect a mouse and a keyboard ...and voila, normal input on your mobile (and its cheaper than bluetooth devices).


I would suggest to make yourself some sample.bmx files doing checks on how to properly define URIs - slashes and not slashes...
I just can say that I use BlitzMaxNG and "/"-slashes on Linux, Mac and Windows -  and in all three OSes my application is able to load various fonts, images, ... files. So I am sure there is something borked on your side - either an odd file encoding?

Are your source files ISO-8859-15 or UTF8 or ?

to check your file encoding in linux:

$ file -bi TVTower.bmx
text/plain; charset=us-ascii

$ file -bi source/main.bmx
text/plain; charset=utf-8

(or open up your editor and check the document settings/information - eg. Geany prints the current encoding).

Maybe you have set an odd charset encoding which leads to your "/" not being registered ... but ... hmm, you use a constant value (your __OS__ thing) so that should not be an issue - except you did that in an imported file and not your "main file".

This can happen if you eg are French and write your comments in French - the accents (or eg. the German Umlauts) can lead some editors to adjust file encoding - eg. MaxIDE did that for a while (or still?).
Yet it should not alter a slash/backslash thing.


bye
Ron

Yellownakji

Quote from: Derron on April 24, 2019, 13:05:56
Use an OTG cable and connect a simple usb hub ... connect a mouse and a keyboard ...and voila, normal input on your mobile (and its cheaper than bluetooth devices).


I would suggest to make yourself some sample.bmx files doing checks on how to properly define URIs - slashes and not slashes...
I just can say that I use BlitzMaxNG and "/"-slashes on Linux, Mac and Windows -  and in all three OSes my application is able to load various fonts, images, ... files. So I am sure there is something borked on your side - either an odd file encoding?

Are your source files ISO-8859-15 or UTF8 or ?

to check your file encoding in linux:

$ file -bi TVTower.bmx
text/plain; charset=us-ascii

$ file -bi source/main.bmx
text/plain; charset=utf-8

(or open up your editor and check the document settings/information - eg. Geany prints the current encoding).

Maybe you have set an odd charset encoding which leads to your "/" not being registered ... but ... hmm, you use a constant value (your __OS__ thing) so that should not be an issue - except you did that in an imported file and not your "main file".

This can happen if you eg are French and write your comments in French - the accents (or eg. the German Umlauts) can lead some editors to adjust file encoding - eg. MaxIDE did that for a while (or still?).
Yet it should not alter a slash/backslash thing.


bye
Ron


Everything source file i have, is ASCII.   I don't work with UTF-8 unless my program is either localized into Korean and Serbian.   This project is American English, so i've stuck with ASCII encoding.  and i do verify this, every so often.

But like i've said, and I have done some more tests, making a slash variable that's adjusted based on ?win32 ?macos ?linux solved the issue.   On windows, regardless if i use a variable or a real local string, i can only use "\".  Vice versa, on unix platforms.   However, on these unix platforms, i can't use a real string.    It only worked when adding a "/" and/or adding a variable containing "/".

but this isn't my problem, anymore, since i've found that work-around.   My issue is that on OSX and probably linux too, i'll test, keyhit(key_capslock) does not work.   i've defined the key to 20, which is what you've told me in the past.   key_capslock only works on WIN and this is an issue because my program does rely on case sensitivity with user input.  So, i really need to iron this one out.

Why doesn't key_capslock work on OSX?

Derron

#17
Key codes might differ between platforms - especially special keys.

Hook into the events and react to "EVENT_KEYDOWN" - print out the keys hit and check what's capslock ... or simply (for this example this is ok - else it is a performance killer ;-)) just do:

Code (BlitzMax) Select

SuperStrict

Graphics 800, 600

Repeat
Cls

For Local i:Int = 0 Until 256
If KeyHit(i) Then Print "Key hit: " + i
Next

Flip
Until KeyHit(KEY_ESCAPE) Or AppTerminate()


On my linux box the caps lock is "229".


As stated somewhere, we should consider adding a "native" BlitzMax-support for requesting the caps lock state (OS wide).


@ backslash and slash
Do not think you solved that: if you have issues with it than something different might not work as intended too.


While I doubt that it helps you might try to add this to your code:
Code (BlitzMax) Select

setlocale(6, "C")


Had to use it with "wxmax" as this modified the locales so that my numbers eg got the German "," instead of "." in floating point numbers ("1,22" instead of "1.22"). Maybe something strange is translating your strings too ?!



bye
Ron

Yellownakji

Quote from: Derron on April 24, 2019, 23:27:19
..

@example code

Funnily enough, Capslock does not return anything... not sure if i want to laugh or not.  :)) :-X    I guess i'll just add a flash for MACOS that you can enable caps by pressing CTRL or something.

My capslock obviously does work on MAC, as i can do caps in MAXIDE.  but i can't detect it, weird.  We might want to open up a support ticket, with Brucey or perhaps, if he has time, get him in this later bit of the thread.  then again though, this thread was for directories, so maybe it's best to move this else where.   I recall you, Derron, saying you might make a support ticket for this? Have you done that?

I'll just use that work around, until then, i suppose.



@translated strings

completely possible. However for OSX,WIN and Linux, my operating system is set to ENGLISH_USA.   My keyboard is set to ENGLISH_USA_106.  I'm not sure what to say.   I could give that tidbit you posted, a spin.

Derron

I wrote Brucey a mail to make him aware of this thread (if he wasn't already). I think he might have some clever idea in mind which I am just not aware of.


@ MaxIDE and the capslock
So you tried my example and hit "capslock" with nothing printed in the console/terminal?



So you have (had) different issues:
- my TDirectoryTree leaded to a crash - but now it doesn't (maybe something avoided a proper recompile of it - assume you recompiled your application too, not just the modules)

- paths only work if you join them with a "conditional based"-slash-string ("/" or "\")

- caps lock on Mac OS not registrable


For "caps lock" I filed an issue to track it, for paths I made Brucey aware of this thread.


bye
Ron

Yellownakji

Quote from: Derron on April 24, 2019, 23:44:09
...

Alrighty, sounds good.  I hope he reaches a conclusion for this soon or updates NG with fixed support.

Yes, your example on OSX did not register "capslock" key.   Keep in mind, i'm using VMWare to emulate OSX, since my MacMini died.  However, on OSX, i can use capitals in MaxIDE, so obviously the button works.  I think this is a BMX issue.

Yes, those were my issues.   and yes, i recompiled BOTH my application and modules.