Closed xanather closed 10 years ago
Is the old generated with "Microsoft Sans Serif" or "MS Sans Serif"? I'm not able to generate "MS Sans Serif" either using the old system or the new. DirectWrite is not supporting bitmap .fon files, so it can't support fonts like "MS Sans Serif", but we could use the old system in case DirectWrite can't handle it... but still, I can't make tkfont working with "MS Sans Serif"
Yeah I cant make MS San Serif either, never could. I realized I used Microsoft Sans Serif for both, which now produces different results.
Edit: In the old system, using Microsoft Sans Serif produced something that looked almost exactly like MS Sans Serif (no antialising/jeggedness)
If you can test latest fix. I tried to emulate the behavior of default System.Drawing font, and actually force no-antialiasing when font-size <= 13. Anti-Aliasing is not completely equal at font size == 14, and is probably on par with higher font sizes.
It is much clearer now, but more spaced out?
Result:
Changing the spacing to negative makes it look unnatural/not what it should.
Ok, hopefully this is the last fix. I have been struggling with the implem, and discovering that the code I used from DirectXTk was invalid in several parts... I should have not trusted it. I have added a new sample to the toolkit sample (SpriteFontApp) that is covering most of the rendering cases and It looks good (hopefully to you as well!), at least much better than before. Let me know if you have any issue with it (oh god of coders, I implore you this is fixed :D )
Well, its working much better now! Few very minor issues though. Some glyphs seem to be spacing incorrectly (only slightly though). Ill create comparison image now. It also seems commas (,) are drawn as dots/fullstops (.), this could just be how directwrite processes such small fonts (I am using Microsoft Sans Serif size 10).
I have tried to improve the issue of spacing (though it has increase slightly the overall width) and the incorrect rendering of "," I'm closing this issue, as the rendering looks correct, probably different from XNA, but I don't see how I can fix these minor space issues.
Alright no problem, looks good now anyway as it. Thanks for all the patches.
Ok, probably last fix. I have modified the code to perform the round on the final value instead of the original advance value. This seems to improve the compact spacing and it looks closer to what we are seeing in Word for example. It is still not perfect with small fonts like MS sans serif 10, but the difference is difficult to distinguish.
Sorry, messed with wrong commit being uploaded. Last version should be fine
I did some changes to the previous implem. Now the system doesn't automatically switch to no-AntiAlias when font is under <= 13. You need for this to specify <AntiAlias>Aliased</AntiAlias>
mode in the xml file.
I have double checked rendering with DirectWrite and offsets and spaces are on par. The only thing that is not supported is that DirectWrite is able to offset at subpixels but we can't do that in SharpDX as we are rendering bitmap fonts snapped to pixels.
Also, you may be interested in using <AntiAlias>ClearType</AntiAlias>
mode that can improve the rendering (specifically for example for Microsoft Sans Serif
10, it looks better than grayscale)
Pfew, quite a big rabbit hole this font rendering thing... Hope that I'm out of it ;)
New:![test](https://f.cloud.github.com/assets/3013922/2147704/80f0fd00-93d6-11e3-9b0e-18ff9c44eff7.png)
Old:![test2](https://f.cloud.github.com/assets/3013922/2147705/8a5fd56e-93d6-11e3-8730-24655b9d4cc1.png)
Now each type of output could benefit difference situations depending on what you are developing. However, is it possible to get the old output with the new tkfont?
The xml file used for generation: http://www.xanather.com/Main.xml