Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

SharpDX Toolkit SpriteBatch.DrawString issue (x positive offseting) #266

Closed
xanather opened this issue Feb 3, 2014 · 16 comments
Closed

Comments

@xanather
Copy link
Contributor

xanather commented Feb 3, 2014

Just got back from a break, the change to fix one letter overlapping itself works now however all the text is offset in the x positive direction alittle. Example is here #86

@xanather
Copy link
Contributor Author

xanather commented Feb 9, 2014

Id rather not have to continuously build my own binaries to make it work properly. Is this issue related to having two different font processors or something? I am using SharpDX's implementation of the DirectX toolkit SpriteFont compiler. According to what has been said before SharpDX now uses the same implementation of DirectX SpriteFont processor so I'm not sure what could cause the issue unless the DirectX Toolkit includes the issue itself. #86 describes this issue.

@ArtiomCiumac
Copy link
Contributor

There is no easy fix, because if we will revert to previous patch - it will cause issues with whitespaces at beginning of the line. The problem lies much deeper, and it may require to rewrite the actual sprite font generation functionality. I will take a look at it once I will find more free time.

@xanather
Copy link
Contributor Author

Should I submit a temporary fix where SpriteFont has a static propery determining whether to ignore the offset at the beginning or not?

@xoofx
Copy link
Member

xoofx commented Feb 10, 2014

I would prefer not. I believe DirectXTk has this problem as well and the problem lies into the font generation. I will investigate to switch to DirectWrite rendering for the compiler.

@xoofx
Copy link
Member

xoofx commented Feb 10, 2014

I have a new working version with DirectWrite that seems to fix this issue, though it seems that supporting underline/strikethrough is a bit problematic. Are you using those?
Edit: Seems that BMFont is not supporting underline/strikethrough, so It would be probably fine to drop this feature

@ArtiomCiumac
Copy link
Contributor

@xoofx, I agree to drop this feature. We can investigate it later - probably a call to IDWriteTextLayout::SetUnderline might help - in case if TextLayout is used to render each char.

@xoofx
Copy link
Member

xoofx commented Feb 10, 2014

I was primarily not using TextLayout (using the lower level part of DirectWrite)... but only TextLayout provide underline/strikethrough. Unfortunately, when using TextLayout, we are loosing the font offsets info, but I have found some possible workaround, testing it right now.

@xanather
Copy link
Contributor Author

I use SharpDX's version of MakeSpriteFont, no underline/strikethrough, never knew such a feature existed in the first place.

xoofx added a commit that referenced this issue Feb 10, 2014
…nd fix issue with offsets/measure when rendering.
@xoofx
Copy link
Member

xoofx commented Feb 10, 2014

Can you try latest version (from sourcecode) and let me know if there is anything wrong?

xoofx added a commit that referenced this issue Feb 11, 2014
…ill snap to the nearest pixel when rendering by rounding advance and line spacing to nearest. Add cleartype rendering (experimental).
@xanather
Copy link
Contributor Author

Sorry for late reply, anyway with the latest sources (including the most recent commit) this happened:

untitled

@xanather
Copy link
Contributor Author

This is the compiled font file that i am using http://www.xanather.com/Main.font

@ArtiomCiumac
Copy link
Contributor

Have you tried to recompile the font? SpriteBatchAndFont Toolkit sample works fine.

@xanather
Copy link
Contributor Author

Will do

@xanather
Copy link
Contributor Author

Yep rendering good now! Thanks for the fix.

@xanather
Copy link
Contributor Author

Well the measurements are fine, however supports for some fonts gone now? I am trying to create a "MS Sans Serif" font but it results in a 0 byte output file. So instead I choose "Microsoft Sans Serif" (they are different), which results in a non 0 byte output file but the difference is that "Microsoft Sans Serif" is anti-aliased/more smooth which I don't want (not solid pixels/has blending). I generated the last font file over 2 months ago and can't remember if I chose "Microsoft Sans Serif" or "MS Sans Serif".

Edit: Just tested out on a old tkfont binary, this seems to be my issue (I think). All I'm trying to do is get a pixelized/not smooth/jagged version out of Microsoft Sans Serif.

Edit2: Silly me, I remember using BMFont to do this. Anyway this issue seems to be fixed so closing...

@xanather
Copy link
Contributor Author

I was right. I can no longer create Jagged fonts with the new TKFont, is this intentional or is it just how DirectWrite handles it?

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

No branches or pull requests

3 participants