1
|
=== modified file 'src/com/goldencode/p2j/ui/client/FontManager.java'
|
2
|
--- src/com/goldencode/p2j/ui/client/FontManager.java 2015-11-23 20:38:12 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/client/FontManager.java 2016-01-10 12:57:09 +0000
|
4
|
@@ -36,6 +36,7 @@
|
5
|
** 018 CA 20151123 When dialog-frames are used, their owning window (from where the font-table is
|
6
|
** determined) is different than the drawing window. Thus release/restore the
|
7
|
** drawing state when calling GuiDriver APIs.
|
8
|
+** 019 SBI 20160110 Changed to install/upload binary fonts only if they are not detected.
|
9
|
*/
|
10
|
|
11
|
package com.goldencode.p2j.ui.client;
|
12
|
@@ -929,8 +930,33 @@
|
13
|
{
|
14
|
GuiDriver driver = (GuiDriver) OutputManager.getDriver();
|
15
|
|
16
|
- fd = driver.createFont(details);
|
17
|
-
|
18
|
+ boolean hasAlias = details.fontAlias != null;
|
19
|
+
|
20
|
+ FontDetails<?> fontAlias = hasAlias ? details.fontAlias : details;
|
21
|
+
|
22
|
+ boolean isInstalled = driver.isFontInstalled(fontAlias.fontName);
|
23
|
+
|
24
|
+ FontDetails<?> detailsCopy = details.copy();
|
25
|
+ // Clear the font definition if the target font is installed and restore its style
|
26
|
+ // if the font has a special font definition for the bold style.
|
27
|
+ if (isInstalled)
|
28
|
+ {
|
29
|
+ FontStyle fontStyle = FontStyle.createStyle(details.boldFontDefinition,
|
30
|
+ fontAlias.style.isItalic(), fontAlias.style.isUnderline());
|
31
|
+ if (hasAlias)
|
32
|
+ {
|
33
|
+ detailsCopy.fontAlias.fontDefinition = null;
|
34
|
+ detailsCopy.fontAlias.style = fontStyle;
|
35
|
+ }
|
36
|
+ else
|
37
|
+ {
|
38
|
+ detailsCopy.fontDefinition = null;
|
39
|
+ detailsCopy.style = fontStyle;
|
40
|
+ }
|
41
|
+ }
|
42
|
+
|
43
|
+ fd = driver.createFont(detailsCopy);
|
44
|
+
|
45
|
// this is here to maximize common code
|
46
|
driver.scaleFont(fd);
|
47
|
|
48
|
|
49
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java'
|
50
|
--- src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java 2015-11-12 16:04:40 +0000
|
51
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java 2016-01-10 11:17:40 +0000
|
52
|
@@ -64,6 +64,7 @@
|
53
|
** 035 CA 20151013 Added support for window resize, z-order operations for the GUI web client.
|
54
|
** 036 CA 20151024 Added support for WINDOW:SENSITIVE attribute.
|
55
|
** EVL 20151106 Adding grey image creation for the given original.
|
56
|
+** 037 SBI 20160110 Added new method to query if the target font is installed or not.
|
57
|
*/
|
58
|
|
59
|
package com.goldencode.p2j.ui.client.gui.driver;
|
60
|
@@ -663,6 +664,16 @@
|
61
|
public FontDetails<F> createFont(FontDetails<F> details);
|
62
|
|
63
|
/**
|
64
|
+ * Queries if the target font is installed.
|
65
|
+ *
|
66
|
+ * @param fontName
|
67
|
+ * The target font name.
|
68
|
+ *
|
69
|
+ * @return True if the target font is installed, otherwise false.
|
70
|
+ */
|
71
|
+ public boolean isFontInstalled(String fontName);
|
72
|
+
|
73
|
+ /**
|
74
|
* Get the width of the specified font.
|
75
|
*
|
76
|
* @param font
|
77
|
|
78
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java'
|
79
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java 2015-11-12 16:04:40 +0000
|
80
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java 2016-01-10 11:54:13 +0000
|
81
|
@@ -515,4 +515,14 @@
|
82
|
{
|
83
|
// not needed for clipboard support in Swing
|
84
|
}
|
85
|
+
|
86
|
+ @Override
|
87
|
+ public boolean isFontInstalled(String fontName)
|
88
|
+ {
|
89
|
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
90
|
+ // Enumerates all physical fonts known to JRE
|
91
|
+ String[] fontFamilies = ge.getAvailableFontFamilyNames();
|
92
|
+
|
93
|
+ return (Arrays.asList(fontFamilies).indexOf(fontName) > -1);
|
94
|
+ }
|
95
|
}
|
96
|
|
97
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java'
|
98
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2016-01-08 00:16:44 +0000
|
99
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2016-01-10 12:51:34 +0000
|
100
|
@@ -38,7 +38,6 @@
|
101
|
** in order to fix a mouse cursor type over its scroll bars.
|
102
|
** 011 SBI 20151208 Added new parameters, scroll amount and scroll unit for wheel events and
|
103
|
** a mouse modifiers mask for all mouse events.
|
104
|
-** SBI 20160107 Changed to upload binary fonts only if they are not detected.
|
105
|
*/
|
106
|
|
107
|
package com.goldencode.p2j.ui.client.gui.driver.web;
|
108
|
@@ -481,21 +480,12 @@
|
109
|
|
110
|
// get the ID for this font
|
111
|
res.font = ++nextFontId;
|
112
|
- boolean isInstalled = websock.isFontInstalled(res.fontName);
|
113
|
- int fontStyle;
|
114
|
- if (isInstalled && details.boldFontDefinition)
|
115
|
- {
|
116
|
- fontStyle = res.style.toInt() | FontStyle.BOLD.toInt();
|
117
|
- }
|
118
|
- else
|
119
|
- {
|
120
|
- fontStyle = res.style.toInt();
|
121
|
- }
|
122
|
+
|
123
|
int jsFont = websock.createFont(res.font,
|
124
|
res.fontName,
|
125
|
res.pointSize,
|
126
|
- fontStyle,
|
127
|
- isInstalled ? null : res.fontDefinition);
|
128
|
+ res.style.toInt(),
|
129
|
+ res.fontDefinition);
|
130
|
|
131
|
res = details.copy();
|
132
|
res.font = jsFont;
|
133
|
@@ -1502,4 +1492,18 @@
|
134
|
{
|
135
|
websock.setSelection(txt);
|
136
|
}
|
137
|
+
|
138
|
+ /**
|
139
|
+ * Returns the boolean value if the target font is installed or not.
|
140
|
+ *
|
141
|
+ * @param fontName
|
142
|
+ * The target font name.
|
143
|
+ *
|
144
|
+ * @return True if the target font is installed, otherwise false.
|
145
|
+ */
|
146
|
+ @Override
|
147
|
+ public boolean isFontInstalled(String fontName)
|
148
|
+ {
|
149
|
+ return websock.isFontInstalled(fontName);
|
150
|
+ }
|
151
|
}
|
152
|
|