Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty rendering output under windows #30

Open
kleinsimon opened this issue Dec 14, 2023 · 4 comments
Open

Empty rendering output under windows #30

kleinsimon opened this issue Dec 14, 2023 · 4 comments

Comments

@kleinsimon
Copy link

kleinsimon commented Dec 14, 2023

Hi tomolt,

Thanks for this library. I'm trying to use it under windows, but I always get an unmodified bitmap, regardless what I do. I used the latest tag 10.2 as well as the current main.

I compiled it with gcc (mingw64) and tested it with the demo from https://github.com/lhf/libschrift-show :

gcc -c -o schrift.o schrift.c
gcc -o schrift.dll -s -shared schrift.o -Wl,--subsystem,windows
gcc -o show.exe show.c -I./ -L./ -lschrift

The program then runs fine, I tried it with different fonts like arial etc, but the resulting image is always plain white. The same happens when I use the library from my own program.
One thing I noticed is that populating the image struct with anything other than 0 results in an error. Is this intended?

@tomolt
Copy link
Owner

tomolt commented Dec 14, 2023

Thank you, I'll investigate this once I find some time.

One thing I noticed is that populating the image struct with anything other than 0 results in an error. Is this intended?

That does sound very odd. The image struct is supposed to be populated by the caller with the width, height, and some memory to store the pixel values to. The exact contents of the pixel memory shouldn't matter, they will be overwritten by sft_render() anyway.

I compiled it with gcc (mingw64) and tested it with the demo from https://github.com/tomolt/libschrift

How did you test with the X11-specific demo program on windows? Did you use a X11-server like Xming or VcXsrv?
Do you have any tips in general for how I can reproduce this problem?

@kleinsimon
Copy link
Author

Ah sorry, that was the wrong link. I took the demo from https://github.com/lhf/libschrift-show

@tomolt
Copy link
Owner

tomolt commented Dec 16, 2023

So far I'm not able to reproduce your issue.
That demo program works fine under Linux.
I also tested it on Windows 10 with MinGW-w64 with the built-in system fonts.
That also generated a non-empty image, although there seems to be some other kind of row stride bug, as the image is skewed horizontally.

What kind of system are you on? Is it x86-64 or ARM? What Windows version?
This might be an endianness problem in the TTF parsing code, or maybe the file mapping code doesn't function properly?

What do you mean by 'populating the image struct with anything other than 0 results in an error'?
What kind of error? Does it crash, or does some function return an error code, or do you get an error message?
Also, what do you mean by 'unmodified bitmap'? (That demo program is supposed to write a Portable Graymap (*.pgm) file
to stdout, not *.bmp.) Is it a completely empty file, or are all pixels blank?

@tomolt
Copy link
Owner

tomolt commented Dec 16, 2023

Alright, so far I found the cause of the skewing bug that happens with libschrift-show on Windows (lhf/libschrift-show#1).
This probably won't solve your issue though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants