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

Proper fix31 support #30

Open
chrisridd opened this issue Mar 31, 2022 · 4 comments
Open

Proper fix31 support #30

chrisridd opened this issue Mar 31, 2022 · 4 comments

Comments

@chrisridd
Copy link

While fvdi supports the v_ftext() etc calls from SpeedoGDOS that use fractional advances (i.e. internally they move the pen position using fractional pixels) actually it just ends up calling v_gtext() which uses integer advances.

It seems NVDI 5 supports both calls correctly, as can be seen by comparing text rendered using v_gtext() (top), v_ftext() (middle) and overlayed for illustration (bottom):

ftext-example

Clearly as you render longer lines the errors accumulate.

FreeType uses fractional fixed-point values internally, so it should be possible to expose this through fvdi using the SpeedoGDOS fix31 type.

A brief review of the fvdi code suggests this would require quite changing quite a lot of existing assembler. VDI calls that would certainly need changing include:

  • v_getbitmap_info()
  • vqt_advance32() and vqt_advance()
  • vqt_pairkern() and vqt_trackkern() (there's no kerning support currently)
  • vst_arbpt32()
  • vst_setsize32()
  • v_ftext() and all variants.
  • vqt_f_extent()

This might mean adding fix31 versions of various existing Fontheader fields such as size (short) into Fontextra. Presumably an application can use vst_arbpt32() and then use v_gtext() so it would mean modifying existing non-fix31 code as well.

@mfro0
Copy link
Member

mfro0 commented May 14, 2022

Hmmm. Merged too early, I suppose. Your changes broke applications that were working fine before. Font sizes aren't calculated correctly anymore and are rendered much too small.

What is supposed to look like this

grab0002

before, now looks like this
grab0001

Text is rendered using vst_font(), vst_height() and v_ftext() (while using v_gtext() instead doesn't change anything).
The sources for my test program are here: https://github.com/mfro0/libcmini-examples , if it helps.

@chrisridd Can you look into it again please to see if there is an easy fix? Otherwise I probably need to revert your changes.

@chrisridd
Copy link
Author

chrisridd commented May 14, 2022

Thanks for the test case! I will look later today. While working on the commit I had noticed Papyrus was using vst_height() with the system font and misbehaving, but the fix for that was clearly insufficient. Good catch.

@chrisridd
Copy link
Author

Looks like a one line fix. PR #37 out for review.

🤞

@mfro0
Copy link
Member

mfro0 commented May 15, 2022

#37 (comment)

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

No branches or pull requests

2 participants