예제 #1
0
        public ClsMatrix SetMatrixYokoElementSet(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 == "〔" || 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);
        }
예제 #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);
        }
예제 #3
0
        public ClsFontGlyph TrnsTateGakiGlyph(ClsFontGlyph clsFG)
        {
            ClsMatrix         clsMatrix;
            int               pfmax, pfidx;
            PathFigure        pf;
            int               psmax, psidx;
            PathSegment       ps;
            BezierSegment     bz;
            PolyBezierSegment pbz;
            LineSegment       ln;
            PolyLineSegment   pln;
            Point             pt;
            string            stype;
            int               ptmax, ptidx;
            string            msg;

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