Code Monkey home page Code Monkey logo

yfonts.shx's Issues

For isocp.shx the font has incorrect bulge and weird vertical alignment

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;

set font to textBox

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 = ............ 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.