Esempio n. 1
0
        public ClsMatrix SetMatrixYokoElementSet(string str, double fontsize)
        {
            ClsMatrix clsMatrix;

            clsMatrix       = new ClsMatrix();
            clsMatrix.xsize = fontsize;
            clsMatrix.ysize = fontsize;
            if (str == "‘" ||
                str == "“" || str == "(" ||
                str == "〔" || str == "[" ||
                str == "{" || str == "〈" ||
                str == "《" || str == "「" ||
                str == "『" || str == "【")
            {
                clsMatrix.a13 = fontsize * (-0.4);
                clsMatrix.a23 = fontsize * 0.86;
            }
            else if (str == "’" ||
                     str == "”" || str == ")" ||
                     str == "〕" || str == "]" ||
                     str == "}" || str == "〉" ||
                     str == "》" || str == "」" ||
                     str == "』" || str == "】")
            {
                clsMatrix.a13 = fontsize * 0.15;
                clsMatrix.a23 = fontsize * 0.86;
            }
            else
            {
                clsMatrix.a23 = fontsize * 0.86;
            }
            return(clsMatrix);
        }
Esempio n. 2
0
        public ClsMatrix SetMatrixTateElementSet(ClsFontGlyph clsFG)
        {
            string    str;
            double    fontsize;
            ClsMatrix clsMatrix;

            str             = clsFG.str;
            fontsize        = clsFG.fontsize;
            clsMatrix       = new ClsMatrix();
            clsMatrix.xsize = fontsize;
            clsMatrix.ysize = fontsize;
            if (str == "ー" || str == "~" || str == "…" || str == "‥")
            {
                clsMatrix.a11 = 0;
                clsMatrix.a12 = -1;
                clsMatrix.a21 = 1;
                clsMatrix.a22 = 0;
                clsMatrix.a23 = 0;
                clsMatrix.a13 = fontsize * 0.125;
                clsMatrix.a23 = fontsize * (0.86 + 0.15);
            }
            else if (str == "‘" ||
                     str == "“" || str == "(" ||
                     str == "〔" || str == "[" ||
                     str == "{" || str == "〈" ||
                     str == "《" || str == "「" ||
                     str == "『" || str == "【")
            {
                clsMatrix.a11 = 0;
                clsMatrix.a12 = -1;
                clsMatrix.a21 = 1;
                clsMatrix.a22 = 0;
                clsMatrix.a23 = 0;
                clsMatrix.a13 = fontsize * 0.125;
                clsMatrix.a23 = fontsize * (0.88 - 0.28);
            }
            else if (str == "’" ||
                     str == "”" || str == ")" ||
                     str == "〕" || str == "]" ||
                     str == "}" || str == "〉" ||
                     str == "》" || str == "」" ||
                     str == "』" || str == "】")
            {
                clsMatrix.a11 = 0;
                clsMatrix.a12 = -1;
                clsMatrix.a21 = 1;
                clsMatrix.a22 = 0;
                clsMatrix.a23 = 0;
                clsMatrix.a13 = fontsize * 0.125;
                clsMatrix.a23 = fontsize * (0.88 + 0.28);
            }
            else if (str == "、" || str == "。" || str == "," || str == ".")
            {
                clsMatrix.a13 = fontsize * 0.6;
                clsMatrix.a23 = fontsize * (0.88 - 0.58);
            }
            else if (str == "ぁ" || str == "ぃ" || str == "ぅ" || str == "ぇ" || str == "ぉ" ||
                     str == "っ" || str == "ゃ" || str == "ゅ" || str == "ょ" || str == "ゎ" ||
                     str == "ァ" || str == "ィ" || str == "ゥ" || str == "ェ" || str == "ォ" ||
                     str == "ォ" || str == "ッ" || str == "ャ" || str == "ュ" || str == "ョ" ||
                     str == "ヮ" || str == "ヵ" || str == "ヶ")
            {
                clsMatrix.a13 = fontsize * 0.1;
                clsMatrix.a23 = fontsize * (0.88 - 0.08);
            }
            else
            {
                clsMatrix.a23 = fontsize * 0.88;
            }
            return(clsMatrix);
        }
Esempio n. 3
0
        public PathGeometry MatrixTrnsPathGeometry(PathGeometry pg, ClsMatrix clsMatrix)
        {
            PathGeometry      tpg;
            int               pfmax, pfidx;
            PathFigure        pf, tpf;
            int               psmax, psidx;
            PathSegment       ps, tps;
            BezierSegment     bz, tbz;
            PolyBezierSegment pbz, tpbz;
            LineSegment       ln, tln;
            PolyLineSegment   pln, tpln;
            string            stype;
            int               ptmax, ptidx;

            tpg   = pg;
            pfmax = pg.Figures.Count;
            for (pfidx = 0; pfidx < pfmax; pfidx++)
            {
                pf             = pg.Figures[pfidx];
                tpf            = tpg.Figures[pfidx];
                tpf.StartPoint = clsMatrix.TrnsPoint(pf.StartPoint);
                psmax          = pf.Segments.Count;
                for (psidx = 0; psidx < psmax; psidx++)
                {
                    ps    = pf.Segments[psidx];
                    tps   = tpf.Segments[psidx];
                    stype = ps.GetType().Name;
                    if (stype.Equals("PolyBezierSegment"))
                    {
                        pbz   = (PolyBezierSegment)ps;
                        tpbz  = (PolyBezierSegment)tps;
                        ptmax = pbz.Points.Count;
                        for (ptidx = 0; ptidx < ptmax; ptidx = ptidx + 3)
                        {
                            tpbz.Points[ptidx]     = clsMatrix.TrnsPoint(pbz.Points[ptidx]);
                            tpbz.Points[ptidx + 1] = clsMatrix.TrnsPoint(pbz.Points[ptidx + 1]);
                            tpbz.Points[ptidx + 2] = clsMatrix.TrnsPoint(pbz.Points[ptidx + 2]);
                        }
                    }
                    else if (stype.Equals("PolyLineSegment"))
                    {
                        pln   = (PolyLineSegment)ps;
                        tpln  = (PolyLineSegment)tps;
                        ptmax = pln.Points.Count;
                        for (ptidx = 0; ptidx < ptmax; ptidx++)
                        {
                            tpln.Points[ptidx] = clsMatrix.TrnsPoint(pln.Points[ptidx]);
                        }
                    }
                    else if (stype.Equals("BezierSegment"))
                    {
                        bz         = (BezierSegment)ps;
                        tbz        = (BezierSegment)tps;
                        tbz.Point1 = clsMatrix.TrnsPoint(bz.Point1);
                        tbz.Point2 = clsMatrix.TrnsPoint(bz.Point2);
                        tbz.Point3 = clsMatrix.TrnsPoint(bz.Point3);
                    }
                    else if (stype.Equals("LineSegment"))
                    {
                        ln        = (LineSegment)ps;
                        tln       = (LineSegment)tps;
                        tln.Point = clsMatrix.TrnsPoint(ln.Point);
                    }
                    else
                    {
                    }
                }
            }
            return(tpg);
        }