Comments (3)
There' re two difference between these version:
1> low-level text renderer engine, GDI or GDI+
2> Graphics.TextRenderingHint, ClearType or AntiAlias
I've wrote a standalone program to compare them, here is it:
var bmp = new Bitmap(500,300);
var g = Graphics.FromImage(bmp);
g.Clear(Color.DarkSlateGray);
int y = 20;
var font = new Font("Arial", 11f, FontStyle.Regular, GraphicsUnit.Pixel);
var fmt = StringFormat.GenericTypographic.Clone() as StringFormat;
string text = "Ambition 90, Willpower 90, Charm 90 EXP can be obtained once when equipped.";
foreach(System.Drawing.Text.TextRenderingHint trh in Enum.GetValues(typeof(System.Drawing.Text.TextRenderingHint))) {
g.TextRenderingHint = trh;
g.DrawString(trh.ToString(), font, Brushes.White, 0, y);
g.DrawString(text, font, Brushes.Orange, 20, y+12);
TextRenderer.DrawText(g, text, font, new Point(20, y+24), Color.Orange);
y+=36;
}
In short words,
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
makes texts more clear.
The advance of space character in GDI is a bit shorter than those in GDI+.
Font fallback in GDI+ looks better than GDI, that's why I use GDI+ mainly in CMS version.
GearGraphics.DrawString
could be replaced with new version if there's no serious bugs. It support both GDI and GDI+ text rendering engine, but it measures with GDI+ and fixed-pitch fallback function.
So, how you merge these code is depend on what you like. :)
from wzcomparerr2.
@Kagamia Using AntiAliasGridFit
makes the font not similar to official GMS version. You can definitely see the font has changed even though it is Arial.
You can see the difference in the images I posted in this issue. Do you see the differences in the font style?
The first two images resemble the font style GMS uses.
However, a friend of mine came with a 'messy' (so he says) solution:
In GearTooltipRender2.cs
line 1290 till 1294, the following is changed:
if (!string.IsNullOrEmpty(medalName))
{
var brush = new SolidBrush(color);
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
TextRenderer.DrawText(g, medalName, font, new Point(130 - width / 2, picH -2), color);
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
brush.Dispose();
Is there a more robust way to do this? Because this code basically resets the TextRenderingHint
back to system default after drawing the medalName text.
from wzcomparerr2.
Yes you get the right way.
Usually, alter and recovery statement is written like this:
var oldVal = g.TextRenderingHint;
g.TextRenderingHint = blablabla
// draw...
g.TextRenderingHint = oldVal;
from wzcomparerr2.
Related Issues (20)
- New feature: SkillTooltipComparison HOT 2
- 能不能提供提取的算法呀,我需要把WZ还原成原本的文件 HOT 2
- Question: meaning of Wz_Uol ? HOT 1
- Unable to render map 410007000 in KMST 1.2.1145 HOT 4
- 是否存在批量提取数据的方法 HOT 2
- 大佬有冲锋岛的素材提取器吗 HOT 1
- How to create my own custom patch file? HOT 1
- MapRender crash at map 410004000 HOT 3
- HTML Comparison sometimes does not account for <> brackets HOT 2
- Etc.wz in GMS client file is not decoded correctly HOT 5
- Halloween related assets don't render properly in KMS 1.2.370 HOT 28
- how do i start HOT 2
- does it infinite loop? HOT 3
- 地图坐标 HOT 1
- Request Import XML HOT 1
- 怎么可以显示出一个完整的扎昆或者黑龙的boss图呢 HOT 3
- Announcement: WcR2 .Net6 alpha version is ready. HOT 2
- File-Close功能无法关闭单独的img格式的wz文档 HOT 1
- CMS v199 -> CMST v193 比对到 Roguelike Skill 时出现问题 HOT 5
- 是否有办法批量下载图片和内容从不同的img和wz中? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wzcomparerr2.