1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.jeuclid.elements.support;
20
21 import net.sourceforge.jeuclid.Constants;
22 import net.sourceforge.jeuclid.LayoutContext;
23 import net.sourceforge.jeuclid.context.Parameter;
24
25
26
27
28
29
30 public final class GraphicsSupport {
31
32
33 public static final float MIN_LINEWIDTH = 1.0f;
34
35 private GraphicsSupport() {
36
37 }
38
39
40
41
42
43
44
45
46 public static float getFontsizeInPoint(final LayoutContext context) {
47 final float scriptMultiplier = (float) Math.pow((Float) context
48 .getParameter(Parameter.SCRIPTSIZEMULTIPLIER),
49 (Integer) context.getParameter(Parameter.SCRIPTLEVEL));
50 final float mathsize = (Float) context
51 .getParameter(Parameter.MATHSIZE);
52 final float scriptminsize = (Float) context
53 .getParameter(Parameter.SCRIPTMINSIZE);
54
55 final float scriptsize = mathsize * scriptMultiplier;
56
57 return Math.max(Math.min(scriptminsize, mathsize), scriptsize);
58 }
59
60
61
62
63
64
65
66
67 public static float lineWidth(final LayoutContext context) {
68 float lineSize = GraphicsSupport.getFontsizeInPoint(context)
69 / Constants.DEFAULT_FONTSIZE;
70 if (lineSize < GraphicsSupport.MIN_LINEWIDTH) {
71 lineSize = GraphicsSupport.MIN_LINEWIDTH;
72 }
73 return lineSize;
74 }
75
76 }