yzylovepmn / yfonts.shx Goto Github PK
View Code? Open in Web Editor NEWautocad shx file parser
Home Page: https://github.com/yzylovepmn/YFonts.SHX
autocad shx file parser
Home Page: https://github.com/yzylovepmn/YFonts.SHX
Hello good time
How can I assign the shx font to a textBox?
ShxFile _shxFile = ShxFile.Load("1.shx"); ;
var fontSize = 24.0;
var data = _shxFile.GetGraphicData(textBox1.Text, fontSize, fontSize / 1.5, fontSize / 10, fontSize / 10).Select(ts =>
ts.Offset(new Vector(0, (double)_shxFile.FontFile.BaseDown / _shxFile.FontFile.BaseUp * fontSize)));
textBox2.Font = ............
The solution to weird vertical alignment:
// Add code as parameter
private static TextShape _ParseCode(ShxFile file, uint code, byte[] data, double scale)
{
var currentP = new Point();
var polyLines = new List<PolyLine>();
var currentPolyLine = new List<Point>();
var sp = new Stack<Point>();
var isPenDown = false;
for (int i = 0; i < data.Length; i++)
{
var cb = data[i];
if (i == 0 && cb == code) continue; // add this
switch (cb)
{
case 0x00:
break;
Solution for bulge (Problem was radian and center of bulge are not calculated properly) :
private static IEnumerable<Point> _GenerateArcPoints(Point start, Vector2 distance, double bulge)
{
var end = start + distance;
var isClockwise = bulge < 0;
var isLargeAngle = false;
bulge = Math.Abs(bulge);
var halfLength = Vector2.Distance(distance, Vector2.Zero) / 2;
var h = halfLength * bulge;
var radian = 4 * Math.Atan(bulge);// Add This for correct radian
var normal = new Vector2(distance.Y, -distance.X);
normal.Normalize();
var radius = Math.Abs(halfLength / Math.Sin(radian / 2));
var temp = Math.Sqrt((radius * radius) - (halfLength * halfLength)); // Add This for correct center
normal *= temp; // Add This for correct center
var center = start + distance / 2;
if (isLargeAngle ^ isClockwise)
center += normal;
else center -= normal;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.