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

Font scaling and getAscent()/getDescent() #27

Open
adielfernandez opened this issue Aug 8, 2018 · 1 comment
Open

Font scaling and getAscent()/getDescent() #27

adielfernandez opened this issue Aug 8, 2018 · 1 comment

Comments

@adielfernandez
Copy link

adielfernandez commented Aug 8, 2018

Hello, I'm trying to fit SdfText into an existing text layout framework and I'm running into trouble getting the appropriate sizes of text. Namely, I need the ascent and descent info for the font at a desired font size. However, despite creating the SdfText object from a SdfText::Font object created at a larger size, the ascent and descent data are still the same.

I have also tried looking at both SdfText::getAscent() and SdfText::Font::getAscent() but these also return the same values regardless of how large or small the font is created.

I saw SdfText::measureString() returns the proper size so I checked out the measureStringImpl() method and found these lines curious:

	const auto& sdfScale = mTextureAtlases->mSdfScale;
	const auto& sdfPadding = mTextureAtlases->mSdfPadding;
	const vec2 fontRenderScale = vec2( mFont.getSize() ) / ( 32.0f * mTextureAtlases->mSdfScale );
	const vec2 fontOriginScale = vec2( mFont.getSize() ) / 32.0f;
	const float scale = options.getScale();

Can you shed some light on all the different scaling going on under the hood? Are the different getAscent()/getDescent() methods supposed to return the same value?

Thanks in advance! Very excited to pull this great block into our framework!

@morphogencc
Copy link

@adielfernandez I'm running into the same issue; did you ever make progress on this?

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