[wadalabfont-kit] / java / MinchoRenderer.java  

Annotation of /java/MinchoRenderer.java

Parent Directory | Revision Log

Revision: 1.1.1.1 - (view) (download) (as text)

1 : ktanaka 1.1 public class MinchoRenderer extends Renderer{
2 :     // $B=DK@$NI}(B
3 :     double width;
4 :     // $B=DK@$KBP$9$k2#K@$NHfN((B
5 :     double ratio;
6 :     // $B$R$i$,$J$NI}(B
7 :     double hiraWidth;
8 :     // $B=DK@$N;OE@$N>~$j(B
9 :     double tateSerif;
10 :     // $B=DK@$H2#K@$N8rE@$N>~$j(B
11 :     double tateYokoSerif;
12 :     // $B2#@~$N;_$a$N=D@~$KBP$9$kHf(B
13 :     double yokoSerif;
14 :     public static MinchoRenderer hosoMincho=
15 :     new MinchoRenderer(8.0,0.2,0.35,1.8,1.8,2.4);
16 :     public static MinchoRenderer chuuMincho=
17 :     new MinchoRenderer(12.0,0.4,0.6,1.5,1.4,1.8);
18 :     public MinchoRenderer(double w,double r,double hw,
19 :     double ts,double tys, double ys){
20 :     width=w; ratio=r; hiraWidth=hw;
21 :     tateSerif=ts; tateYokoSerif=tys; yokoSerif=ys;
22 :     }
23 :     static Outline[] tenSample;
24 :     // $BE@$NIA2h(B
25 :     public Outline[] ten(Point[] points,ElementAnnotation[] annotations){
26 :     if(tenSample==null){
27 :     tenSample=new Outline[2];
28 :     OutlineComponent[] lc=new OutlineComponent[1];
29 :     lc[0]=new Bezier(new Point(80,171),new Point(119,214),
30 :     new Point(104,256),new Point(136,255));
31 :     tenSample[0]=new Outline(lc);
32 :     lc=new OutlineComponent[1];
33 :     lc[0]=new Bezier(new Point(80,171),new Point(155,204),
34 :     new Point(173,251),new Point(136,255));
35 :     tenSample[1]=new Outline(lc);
36 :     }
37 :     // $B$3$l$r(B p0,p1$B$K(Bfit$B$9$k(B
38 :     return line2(points[0],points[1],width);
39 :     }
40 :     // $B=DK@$NIA2h(B
41 :     public Outline[] tate(Point[] points,ElementAnnotation[] annotations){
42 :     return line2(points[0],points[1],width);
43 :     }
44 :     // $B2#K@$NIA2h(B
45 :     public Outline[] yoko(Point[] points,ElementAnnotation[] annotations){
46 :     return line2(points[0],points[1],width*ratio);
47 :     }
48 :     // $B1&>e(B
49 :     public Outline[] migiue(Point[] points,ElementAnnotation[] annotations){
50 :     return curve2(points[0],points[1],points[2],
51 :     0.6,0.6,
52 :     width,0.7*width,0.3*width,0.0);
53 :     }
54 :     // $B:8J'$$(B
55 :     public Outline[] hidari(Point[] points,ElementAnnotation[] annotations){
56 :     Point p0=points[0],p1=points[1],p2=points[2];
57 :     double w=Math.min(width,0.35*p0.distance(p2));
58 :     double len01=p0.distance(p1),len12=p1.distance(p2);
59 :     double ratio=len01/(len01+len12);
60 :     double theta=p1.minus(p0).theta(p2.minus(p1));
61 :     double s=Math.min(1.0,theta*0.7);
62 :     double w1=(1-s)*ratio*w+s*w;
63 :     double r0=Math.max(0.66666,1.0+0.5*(1.0-1.0/ratio));
64 :     Point a0=p0.
65 :    
66 :     return curve2(points[0],points[1],points[2],
67 :     0.6,0.6,
68 :     width,0.7*width,0.3*width,0.0);
69 :     }
70 :     // $B1&J'$$(B
71 :     public Outline[] migi(Point[] points,ElementAnnotation[] annotations){
72 :     return curve2(points[0],points[1],points[2],
73 :     0.6,0.6,
74 :     0.5*width,0.68*width,1.03*width,1.2*width);
75 :     }
76 :    
77 :     }

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help