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

Update ofTrueTypeFont.cpp to make it work with Emscripten #6764

Closed
wants to merge 8 commits into from

Conversation

Jonathhhan
Copy link
Contributor

I made a pull request coming from this issue: #6745
Not sure if my change has any drawbacks.

@ofTheo
Copy link
Member

ofTheo commented Oct 5, 2021

Hmm. This change does change the way text is rendered for all other platforms too.
I just did a side by side test and the kerning is different between the two.

Do you have any error messages that pointed you towards removing that flag?

If it is just not supported anymore we could do something like this which would remove it just for emscripten.

	bool autoHint = settings.antialiased;
	#ifdef OF_TARGET_EMSCRIPTEN
		autoHint = false;
	#endif
	
	auto err = FT_Load_Glyph( face.get(), FT_Get_Char_Index( face.get(), utf8 ), autoHint ?  FT_LOAD_FORCE_AUTOHINT : FT_LOAD_DEFAULT );

@Jonathhhan
Copy link
Contributor Author

@ofTheo that looks good. It would be even better to make FT_LOAD_FORCE_AUTOHINT work with Emscripten again, but not sure how to do that.

@Jonathhhan
Copy link
Contributor Author

Jonathhhan commented Oct 7, 2021

The error message (in the browser) is:
exception thrown: RuntimeError: null function or function signature mismatch,RuntimeError: null function or function signature mismatch
And your suggestion works for me.

@ofTheo
Copy link
Member

ofTheo commented Apr 12, 2022

Going to close this @Jonathhhan as it has a bunch of unrelated commits.

I think maybe it would be good to clone the OF Github to another location on your hardrive ( just for doing PRs ).

so in another location on your computer:

mkdir ofMainRepo 
cd ofMainRepo
git clone -–depth 1 https://github.com/openframeworks/openFrameworks 

Anytime you want to do a PR:

//1 - update your OF clone master to be up to date 
git pull https://github.com/openframeworks/openFrameworks master 

//2 - make a new branch
git checkout -b bugfix-ttf 

//3 - copy over the changes just for the PR into this location  

//4 - git add the file(s) and commit 

//5 - push your changes for just the PR to your repo ( it will create the branch bugfix-ttf  automatically ) 
git push https://github.com/Jonathhhan/openFrameworks 

//6 - go to https://github.com/Jonathhhan/openFrameworks and it should suggest you might want to make a PR with the new branch

//7 - Once you are done go back to master so you don't make changes on the wrong branch 
git checkout master 

//7 - repeat :) 

@ofTheo ofTheo closed this Apr 12, 2022
@Jonathhhan
Copy link
Contributor Author

Hey @ofTheo,
thanks a lot for the github instruction, thats (besides a lack of time) where I am stuck at the moment.
Actually my pull request is just your code suggestion from above. But yeah, I made some Github mistakes in the beginning and a lot of changes are in my master branch.
I will definitely come back to my pull requests eventually.

@ofTheo
Copy link
Member

ofTheo commented Apr 12, 2022

No problem!
I can at least get that fix in ( I can cherry pick / pull that file from your repo ).

To be honest, it took me a while to get a good workflow for doing PRs too, so thought I would share. 🙂
Thanks for all your work on this!

@Jonathhhan
Copy link
Contributor Author

Actually this change does not seem to be necessary anymore with the current Emscripten (3.1.19).

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

Successfully merging this pull request may close these issues.

2 participants