Carry mona patch forward
[netsurf-overlay.git] / www-client / netsurf / files / netsurf-9999-add-mona-family.patch
blobc30b9bf695a9fc738ae85135719196b3d7cef023
1 From 31752d332b4798d377800e68854955847ab2bd8e Mon Sep 17 00:00:00 2001
2 From: "S. Gilles" <sgilles@math.umd.edu>
3 Date: Sun, 29 May 2016 00:28:55 -0400
4 Subject: [PATCH] Hardcode `mona' font until all arbitrary fonts hit
6 ---
7 Docs/BUILDING-Framebuffer | 2 ++
8 Docs/Options | 2 ++
9 Docs/USING-Framebuffer | 1 +
10 Docs/netsurf-fb.1 | 3 +++
11 Docs/netsurf-gtk.1 | 2 ++
12 content/handlers/css/dump.c | 3 +++
13 content/handlers/css/select.c | 3 +++
14 desktop/options.h | 3 +++
15 desktop/plot_style.h | 1 +
16 frontends/framebuffer/Makefile | 1 +
17 frontends/framebuffer/Makefile.defaults | 1 +
18 frontends/framebuffer/font_freetype.c | 16 ++++++++++++++++
19 frontends/framebuffer/options.h | 1 +
20 frontends/gtk/gui.c | 1 +
21 frontends/gtk/layout_pango.c | 3 +++
22 frontends/gtk/res/options.gtk2.ui | 3 +++
23 frontends/gtk/res/options.gtk3.ui | 3 +++
24 render/font.c | 3 +++
25 resources/FatMessages | 8 ++++++++
26 19 files changed, 60 insertions(+)
28 diff --git a/Docs/BUILDING-Framebuffer b/Docs/BUILDING-Framebuffer
29 index 3c8858a..f3683a2 100644
30 --- a/Docs/BUILDING-Framebuffer
31 +++ b/Docs/BUILDING-Framebuffer
32 @@ -242,6 +242,7 @@
33 NETSURF_FB_FONT_MONOSPACE_BOLD
34 NETSURF_FB_FONT_CURSIVE
35 NETSURF_FB_FONT_FANTASY
36 + NETSURF_FB_FONT_MONA
38 The font selection may be changed by placing truetype font files
39 in the resources path. The resource files will be the generic names
40 @@ -264,6 +265,7 @@
41 fb_face_monospace_bold - The bold monospaced font
42 fb_face_cursive - The cursive font
43 fb_face_fantasy - The fantasy font
44 + fb_face_mona - The mona font
46 Old Freetype
47 --------------
48 diff --git a/Docs/Options b/Docs/Options
49 index 89b8814..e29b603 100644
50 --- a/Docs/Options
51 +++ b/Docs/Options
52 @@ -54,6 +54,8 @@ General Options
53 | | | | |
54 | font_fantasy | string | NULL | Default fantasy font
55 | | | | |
56 +| font_mona | string | NULL | Default mona font
57 +| | | | |
58 | accept_language | string | NULL | Accept-Language header.
59 | | | | |
60 | accept_charset | string | NULL | Accept-Charset header.
61 diff --git a/Docs/USING-Framebuffer b/Docs/USING-Framebuffer
62 index 3af8f98..b846b18 100644
63 --- a/Docs/USING-Framebuffer
64 +++ b/Docs/USING-Framebuffer
65 @@ -205,3 +205,4 @@ Configuring
66 fb_face_monospace_bold - The bold monospaced font
67 fb_face_cursive - The cursive font
68 fb_face_fantasy - The fantasy font
69 + fb_face_mona - The mona font
70 diff --git a/Docs/netsurf-fb.1 b/Docs/netsurf-fb.1
71 index e4c3100..dd7837b 100644
72 --- a/Docs/netsurf-fb.1
73 +++ b/Docs/netsurf-fb.1
74 @@ -80,6 +80,9 @@ Family name of the cursive font.
75 .B \-\-font_fantasy
76 Family name of the fantasy font.
77 .TP
78 +.B \-\-font_mona
79 +Family name of the mona font.
80 +.TP
81 .B \-\-accept_language
82 Languages to accept.
83 .TP
84 diff --git a/Docs/netsurf-gtk.1 b/Docs/netsurf-gtk.1
85 index 7b2f4f4..adcdbde 100644
86 --- a/Docs/netsurf-gtk.1
87 +++ b/Docs/netsurf-gtk.1
88 @@ -57,6 +57,8 @@ Family name of the monospace font.
89 Family name of the cursive font.
90 .It Fl -font_fantasy
91 Family name of the fantasy font.
92 +.It Fl -font_mona
93 +Family name of the mona font.
94 .It Fl -accept_language
95 Languages to accept.
96 .It Fl -accept_charset
97 diff --git a/content/handlers/css/dump.c b/content/handlers/css/dump.c
98 index 125b133..0648d7d 100644
99 --- a/content/handlers/css/dump.c
100 +++ b/content/handlers/css/dump.c
101 @@ -896,6 +896,9 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
102 case CSS_FONT_FAMILY_MONOSPACE:
103 fprintf(stream, " monospace ");
104 break;
105 + case CSS_FONT_FAMILY_MONA:
106 + fprintf(stream, " mona ");
107 + break;
111 diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
112 index ea324e7..452e010 100644
113 --- a/content/handlers/css/select.c
114 +++ b/content/handlers/css/select.c
115 @@ -1801,6 +1801,9 @@ css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)
116 case PLOT_FONT_FAMILY_FANTASY:
117 hint->status = CSS_FONT_FAMILY_FANTASY;
118 break;
119 + case PLOT_FONT_FAMILY_MONA:
120 + hint->status = CSS_FONT_FAMILY_MONA;
121 + break;
123 } else if (property == CSS_PROP_QUOTES) {
124 /** \todo Not exactly useful :) */
125 diff --git a/desktop/options.h b/desktop/options.h
126 index 2f36887..897df6d 100644
127 --- a/desktop/options.h
128 +++ b/desktop/options.h
129 @@ -79,6 +79,9 @@ NSOPTION_STRING(font_cursive, NULL)
130 /** Default fantasy font */
131 NSOPTION_STRING(font_fantasy, NULL)
133 +/** Default mona font */
134 +NSOPTION_STRING(font_mona, NULL)
136 /** Accept-Language header. */
137 NSOPTION_STRING(accept_language, NULL)
139 diff --git a/desktop/plot_style.h b/desktop/plot_style.h
140 index af54e79..ce7cdcc 100644
141 --- a/desktop/plot_style.h
142 +++ b/desktop/plot_style.h
143 @@ -130,6 +130,7 @@ typedef enum {
144 PLOT_FONT_FAMILY_MONOSPACE,
145 PLOT_FONT_FAMILY_CURSIVE,
146 PLOT_FONT_FAMILY_FANTASY,
147 + PLOT_FONT_FAMILY_MONA,
148 PLOT_FONT_FAMILY_COUNT /**< Number of generic families */
149 } plot_font_generic_family_t;
151 diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile
152 index 15888ae..7eaad15 100644
153 --- a/frontends/framebuffer/Makefile
154 +++ b/frontends/framebuffer/Makefile
155 @@ -19,6 +19,7 @@ CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE="$(NETSURF_FB_FONT_MONOSPACE)"'
156 CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE_BOLD="$(NETSURF_FB_FONT_MONOSPACE_BOLD)"'
157 CFLAGS += '-DNETSURF_FB_FONT_CURSIVE="$(NETSURF_FB_FONT_CURSIVE)"'
158 CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_FB_FONT_FANTASY)"'
159 +CFLAGS += '-DNETSURF_FB_FONT_MONA="$(NETSURF_FB_FONT_MONA)"'
161 CFLAGS += -std=c99 -g -Dsmall \
162 -D_BSD_SOURCE \
163 diff --git a/frontends/framebuffer/Makefile.defaults b/frontends/framebuffer/Makefile.defaults
164 index 92d837e..97cb31c 100644
165 --- a/frontends/framebuffer/Makefile.defaults
166 +++ b/frontends/framebuffer/Makefile.defaults
167 @@ -36,6 +36,7 @@ NETSURF_FB_FONT_MONOSPACE := DejaVuSansMono.ttf
168 NETSURF_FB_FONT_MONOSPACE_BOLD := DejaVuSansMono-Bold.ttf
169 NETSURF_FB_FONT_CURSIVE := Comic_Sans_MS.ttf
170 NETSURF_FB_FONT_FANTASY := Impact.ttf
171 +NETSURF_FB_FONT_MONA := ipagp-mona.ttf
173 # Default binary install path
174 NETSURF_FRAMEBUFFER_BIN := $(PREFIX)/bin/
175 diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c
176 index 7756ae7..c009bcb 100644
177 --- a/frontends/framebuffer/font_freetype.c
178 +++ b/frontends/framebuffer/font_freetype.c
179 @@ -66,6 +66,7 @@ enum fb_face_e {
180 FB_FACE_MONOSPACE_BOLD,
181 FB_FACE_CURSIVE,
182 FB_FACE_FANTASY,
183 + FB_FACE_MONA,
184 FB_FACE_COUNT
187 @@ -296,6 +297,17 @@ bool fb_font_init(void)
188 fb_faces[FB_FACE_FANTASY] = fb_face;
191 + /* mona face */
192 + fb_face = fb_new_face(nsoption_charp(fb_face_mona),
193 + "ipagp-mona.ttf",
194 + NETSURF_FB_FONT_MONA);
195 + if (fb_face == NULL) {
196 + /* mona face unavailable use the default */
197 + fb_faces[FB_FACE_MONA] = fb_faces[FB_FACE_SANS_SERIF];
198 + } else {
199 + fb_faces[FB_FACE_MONA] = fb_face;
203 /* set the default render mode */
204 if (nsoption_bool(fb_font_monochrome) == true)
205 @@ -366,6 +378,10 @@ static void fb_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
206 selected_face = FB_FACE_FANTASY;
207 break;
209 + case PLOT_FONT_FAMILY_MONA:
210 + selected_face = FB_FACE_MONA;
211 + break;
213 case PLOT_FONT_FAMILY_SANS_SERIF:
214 default:
215 if ((fstyle->flags & FONTF_ITALIC) ||
216 diff --git a/frontends/framebuffer/options.h b/frontends/framebuffer/options.h
217 index eee6f4b..c3a565a 100644
218 --- a/frontends/framebuffer/options.h
219 +++ b/frontends/framebuffer/options.h
220 @@ -62,6 +62,7 @@ NSOPTION_STRING(fb_face_monospace, NULL)
221 NSOPTION_STRING(fb_face_monospace_bold, NULL)
222 NSOPTION_STRING(fb_face_cursive, NULL)
223 NSOPTION_STRING(fb_face_fantasy, NULL)
224 +NSOPTION_STRING(fb_face_mona, NULL)
227 * Local Variables:
228 diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
229 index 6430f9d..e06a81c 100644
230 --- a/frontends/gtk/gui.c
231 +++ b/frontends/gtk/gui.c
232 @@ -218,6 +218,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
233 nsoption_set_charp(font_mono, strdup("Monospace"));
234 nsoption_set_charp(font_cursive, strdup("Serif"));
235 nsoption_set_charp(font_fantasy, strdup("Serif"));
236 + nsoption_set_charp(font_mona, strdup("IPAMonaPGothic"));
238 return NSERROR_OK;
240 diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c
241 index 49b6293..a951d2a 100644
242 --- a/frontends/gtk/layout_pango.c
243 +++ b/frontends/gtk/layout_pango.c
244 @@ -271,6 +271,9 @@ nsfont_style_to_description(const plot_font_style_t *fstyle)
245 case PLOT_FONT_FAMILY_FANTASY:
246 desc = pango_font_description_from_string(nsoption_charp(font_fantasy));
247 break;
248 + case PLOT_FONT_FAMILY_MONA:
249 + desc = pango_font_description_from_string(nsoption_charp(font_mona));
250 + break;
251 case PLOT_FONT_FAMILY_SANS_SERIF:
252 default:
253 desc = pango_font_description_from_string(nsoption_charp(font_sans));
254 diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui
255 index d5542ba..b4a6c2d 100644
256 --- a/frontends/gtk/res/options.gtk2.ui
257 +++ b/frontends/gtk/res/options.gtk2.ui
258 @@ -2862,6 +2862,9 @@
259 <row>
260 <col id="0" translatable="yes">preferencesFonttypeFantasy</col>
261 </row>
262 + <row>
263 + <col id="0" translatable="yes">preferencesFonttypeMona</col>
264 + </row>
265 </data>
266 </object>
267 <object class="GtkImage" id="image1">
268 diff --git a/frontends/gtk/res/options.gtk3.ui b/frontends/gtk/res/options.gtk3.ui
269 index 2a3516f..4a98971 100644
270 --- a/frontends/gtk/res/options.gtk3.ui
271 +++ b/frontends/gtk/res/options.gtk3.ui
272 @@ -2881,6 +2881,9 @@
273 <row>
274 <col id="0" translatable="yes">preferencesFonttypeFantasy</col>
275 </row>
276 + <row>
277 + <col id="0" translatable="yes">preferencesFonttypeMona</col>
278 + </row>
279 </data>
280 </object>
281 <object class="GtkListStore" id="liststore_developer_view">
282 diff --git a/render/font.c b/render/font.c
283 index 831097e..8ad3dac 100644
284 --- a/render/font.c
285 +++ b/render/font.c
286 @@ -51,6 +51,9 @@ static plot_font_generic_family_t plot_font_generic_family(
287 case CSS_FONT_FAMILY_FANTASY:
288 plot = PLOT_FONT_FAMILY_FANTASY;
289 break;
290 + case CSS_FONT_FAMILY_MONA:
291 + plot = PLOT_FONT_FAMILY_MONA;
292 + break;
293 case CSS_FONT_FAMILY_SANS_SERIF:
294 default:
295 plot = PLOT_FONT_FAMILY_SANS_SERIF;
296 diff --git a/resources/FatMessages b/resources/FatMessages
297 index 9a86234..c14b6de 100644
298 --- a/resources/FatMessages
299 +++ b/resources/FatMessages
300 @@ -2542,6 +2542,9 @@ nl.gtk.preferencesFonttypeCursive:Cursief
301 en.gtk.preferencesFonttypeFantasy:Fantasy
302 fr.gtk.preferencesFonttypeFantasy:Fantasy
303 nl.gtk.preferencesFonttypeFantasy:Fantasie
304 +en.gtk.preferencesFonttypeMona:Mona
305 +fr.gtk.preferencesFonttypeMona:Mona
306 +nl.gtk.preferencesFonttypeMona:Mona
307 en.gtk.preferencesPrivacyTabtitle:Privacy
308 fr.gtk.preferencesPrivacyTabtitle:Confidentialité
309 nl.gtk.preferencesPrivacyTabtitle:Privacy
310 @@ -6122,6 +6125,11 @@ de.all.FontFantasy:Fantasy
311 fr.all.FontFantasy:Fantaisie
312 it.all.FontFantasy:Fantasia
313 nl.all.FontFantasy:Fantasie
314 +en.all.FontMona:Mona
315 +de.all.FontMona:Mona
316 +fr.all.FontMona:Mona
317 +it.all.FontMona:Mona
318 +nl.all.FontMona:Mona
319 en.ami.FontFallback:Preferred fallback
320 de.ami.FontFallback:Preferred fallback
321 fr.ami.FontFallback:Police de caractères de secour préférée
323 2.8.3