Skip to content

Commit c6508d3

Browse files
committed
fix an extra
1 parent d3bb6b1 commit c6508d3

File tree

2 files changed

+262
-6
lines changed

2 files changed

+262
-6
lines changed

sources.extra/microwindows.diff

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
diff --git a/src/Makefile.rules b/src/Makefile.rules
2+
index 1a6faa1..6f71950 100644
3+
--- a/src/Makefile.rules
4+
+++ b/src/Makefile.rules
5+
@@ -514,9 +514,7 @@ ifneq ($(LIBNAMESO),) # stop circular dependecy when no LIBNAMESO in current Ma
6+
$(MW_DIR_LIB)/$(LIBNAMESO): $(MW_DIR_LIB)/$(LIBNAME) $(OBJS) $(CXXOBJS)
7+
@echo "Creating shared library $(patsubst $(MW_DIR_LIB)/%,%,$@) ..."
8+
ifeq ($(ARCH), MACOSX)
9+
- $(CC) -shared -fpic -undefined dynamic_lookup -o $@ $(LDFLAGS) $(OBJS) $(CXXOBJS)
10+
-else
11+
- $(CC) -shared -o $@ -Wl,--whole-archive $(OBJS) $(CXXOBJS) -Wl,--no-whole-archive
12+
+ $(CC) -shared -fpic -o $@ $(OBJS) $(CXXOBJS)
13+
endif
14+
endif
15+
endif
16+
diff --git a/src/demos/mwin/Makefile b/src/demos/mwin/Makefile
17+
index 05c0470..7f32224 100644
18+
--- a/src/demos/mwin/Makefile
19+
+++ b/src/demos/mwin/Makefile
20+
@@ -115,7 +115,7 @@ ifeq ($(MICROWINMULTIAPP), Y)
21+
ifeq ($(ARCH), MACOSX)
22+
$(CC) -shared -fpic -undefined dynamic_lookup $< -o [email protected]
23+
else
24+
- $(CC) -shared -o [email protected] -Wl,--whole-archive $< -Wl,--no-whole-archive
25+
+ $(CC) -shared -fpic -o [email protected] $<
26+
endif
27+
else # !MICROWINMULTIAPP
28+
$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(MWINLIBS) $(LDFLAGS)
29+
@@ -127,7 +127,7 @@ ifeq ($(MICROWINMULTIAPP), Y)
30+
ifeq ($(ARCH), MACOSX)
31+
$(CC) -shared -fpic -undefined dynamic_lookup $< $(MINEIMAGES) -o [email protected]
32+
else
33+
- $(CC) -shared -o [email protected] -Wl,--whole-archive $< $(MINEIMAGES) -Wl,--no-whole-archive
34+
+ $(CC) -shared -fpic -o [email protected] $< $(MINEIMAGES)
35+
endif
36+
else
37+
$(CC) $(CFLAGS) $(LDFLAGS) $< $(MINEIMAGES) -o $@ $(MWINLIBS) $(LDFLAGS)
38+
diff --git a/src/engine/font_freetype2.c b/src/engine/font_freetype2.c
39+
index 7e0efae..20e64d0 100644
40+
--- a/src/engine/font_freetype2.c
41+
+++ b/src/engine/font_freetype2.c
42+
@@ -54,10 +54,12 @@ void winfillrect(PSD psd, int x, int y, int w, int h);
43+
/* FreeType 2.x */
44+
/* **************************************************************************/
45+
#include <ft2build.h>
46+
-#include FT_FREETYPE_H
47+
-#include FT_TRIGONOMETRY_H
48+
-#include FT_GLYPH_H
49+
-#include FT_OUTLINE_H
50+
+#include <freetype/config/ftheader.h>
51+
+#include <freetype/freetype.h>
52+
+#include <freetype/fttrigon.h>
53+
+#include <freetype/ftglyph.h>
54+
+#include <freetype/ftoutln.h>
55+
+
56+
57+
#if HAVE_HARFBUZZ_SUPPORT
58+
/* HarfBuzz 0.9.x */
59+
@@ -153,10 +155,10 @@ void winfillrect(PSD psd, int x, int y, int w, int h);
60+
#endif
61+
62+
#if HAVE_FREETYPE_2_CACHE
63+
-# include FT_CACHE_H
64+
-# include FT_CACHE_SMALL_BITMAPS_H
65+
+# include <freetype/ftcache.h>
66+
+//# include FT_CACHE_SMALL_BITMAPS_H
67+
# if HAVE_FREETYPE_2_CMAP_CACHE
68+
-# include FT_CACHE_CHARMAP_H
69+
+//# include FT_CACHE_CHARMAP_H
70+
# endif
71+
#endif
72+
73+
@@ -208,7 +210,7 @@ typedef struct {
74+
hb_font_t *hb_font;
75+
hb_script_t hb_script;
76+
int use_harfbuzz;
77+
-#endif
78+
+#endif
79+
#else
80+
FT_Face face;
81+
#endif
82+
@@ -327,7 +329,7 @@ freetype2_face_requester(FTC_FaceID face_id, FT_Library library,
83+
if (fontdata->isBuffer) {
84+
unsigned char * buffer = fontdata->data.buffer.data;
85+
unsigned length = fontdata->data.buffer.length;
86+
- /* DPRINTF("Font magic = '%c%c%c%c', len = %u @ freetype2_face_requester\n",
87+
+ /* DPRINTF("Font magic = '%c%c%c%c', len = %u @ freetype2_face_requester\n",
88+
(char)buffer[0], (char)buffer[1], (char)buffer[2], (char)buffer[3], length); */
89+
assert(buffer);
90+
rr = FT_New_Memory_Face(library, buffer, length, 0, aface);
91+
@@ -338,7 +340,7 @@ freetype2_face_requester(FTC_FaceID face_id, FT_Library library,
92+
rr = FT_New_Face(library, filename, 0, aface);
93+
94+
}
95+
-
96+
+
97+
return rr;
98+
}
99+
#endif
100+
@@ -587,7 +589,7 @@ freetype2_createfontfrombuffer(const unsigned char *buffer, unsigned size,
101+
faceid->data.buffer.data = buffercopy;
102+
faceid->refcount = 1;
103+
104+
- /*DPRINTF("Font magic = '%c%c%c%c', len = %u @ freetype2_createfontfrombuffer\n",
105+
+ /*DPRINTF("Font magic = '%c%c%c%c', len = %u @ freetype2_createfontfrombuffer\n",
106+
(char)buffercopy[0], (char)buffercopy[1], (char)buffercopy[2], (char)buffercopy[3], size); */
107+
108+
pf = freetype2_createfont_internal(faceid, NULL, height, width);
109+
@@ -863,7 +865,7 @@ freetype2_setfontsize(PMWFONT pfont, MWCOORD height, MWCOORD width)
110+
/* We want real pixel sizes ... not points ... */
111+
FT_Set_Pixel_Sizes(pf->face, pixel_width, pixel_height);
112+
#endif
113+
-
114+
+
115+
return oldsize;
116+
}
117+
118+
@@ -994,7 +996,7 @@ freetype2_get_glyph_size(PMWFREETYPE2FONT pf, FT_Face face, int glyph_index,
119+
120+
assert (pf);
121+
assert (face);
122+
-
123+
+
124+
#if HAVE_FREETYPE_2_CACHE
125+
if (CAN_USE_FT2_CACHE(pf))
126+
{
127+
@@ -1003,9 +1005,9 @@ freetype2_get_glyph_size(PMWFREETYPE2FONT pf, FT_Face face, int glyph_index,
128+
error = FTC_SBitCache_Lookup(freetype2_cache_sbit, &pf->imagedesc, glyph_index, &sbit, NULL);
129+
if (error)
130+
return error;
131+
-
132+
+
133+
/*DPRINTF("sbit->top = %d, sbit->height = %d\n", sbit->top, sbit->height);*/
134+
-
135+
+
136+
if (padvance)
137+
*padvance = sbit->xadvance;
138+
if (pascent)
139+
@@ -1027,20 +1029,20 @@ freetype2_get_glyph_size(PMWFREETYPE2FONT pf, FT_Face face, int glyph_index,
140+
{
141+
FT_Glyph glyph;
142+
FT_BBox bbox;
143+
-
144+
+
145+
error = FT_Get_Glyph(face->glyph, &glyph);
146+
if (error)
147+
return error;
148+
-
149+
+
150+
FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_pixels, &bbox);
151+
FT_Done_Glyph(glyph);
152+
-
153+
+
154+
if (pascent)
155+
*pascent = bbox.yMax;
156+
if (pdescent)
157+
*pdescent = -bbox.yMin;
158+
}
159+
-
160+
+
161+
return 0;
162+
}
163+
}
164+
@@ -1205,7 +1207,7 @@ freetype2_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
165+
#if HAVE_HARFBUZZ_SUPPORT
166+
hb_glyph_info_t *glyph_info = NULL;
167+
#endif // HAVE_HARFBUZZ_SUPPORT
168+
-
169+
+
170+
assert(pf);
171+
assert(text);
172+
assert(psd); // note in STANDALONE case, 'app_t' is passed as psd, must not inspect pointer!
173+
@@ -1333,7 +1335,7 @@ freetype2_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
174+
MWCOORD fnt_h, fnt_w, fnt_b;
175+
#if STANDALONE
176+
/* fill to gr_background color*/
177+
- MWPIXELVAL gr_save = winsetfgcolor(psd, gr_background);
178+
+ MWPIXELVAL gr_save = winsetfgcolor(psd, gr_background);
179+
#else
180+
MWPIXELVAL gr_save = gr_background;
181+
gr_foreground = gr_background;
182+
@@ -1356,7 +1358,7 @@ freetype2_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
183+
if(pf->use_harfbuzz)
184+
curchar = glyph_info[i].codepoint;
185+
else
186+
-#endif // HAVE_HARFBUZZ_SUPPORT
187+
+#endif // HAVE_HARFBUZZ_SUPPORT
188+
curchar = LOOKUP_CHAR(pf, face, str[i]);
189+
190+
if (use_kerning && last_glyph_code && curchar) {
191+
@@ -1437,7 +1439,7 @@ freetype2_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
192+
MWCOORD fnt_h, fnt_w, fnt_b;
193+
#if STANDALONE
194+
/* fill to gr_background color*/
195+
- MWPIXELVAL gr_save = winsetfgcolor(psd, gr_background);
196+
+ MWPIXELVAL gr_save = winsetfgcolor(psd, gr_background);
197+
#else
198+
MWPIXELVAL gr_save = gr_background;
199+
gr_foreground = gr_background;
200+
@@ -1458,7 +1460,7 @@ freetype2_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
201+
if(pf->use_harfbuzz)
202+
curchar = glyph_info[i].codepoint;
203+
else
204+
-#endif // HAVE_HARFBUZZ_SUPPORT
205+
+#endif // HAVE_HARFBUZZ_SUPPORT
206+
curchar = LOOKUP_CHAR(pf, face, str[i]);
207+
208+
if (use_kerning && last_glyph_code && curchar) {
209+
@@ -1588,7 +1590,7 @@ freetype2_gettextsize_rotated(PMWFREETYPE2FONT pf, const void *text, int cc,
210+
#if HAVE_HARFBUZZ_SUPPORT
211+
hb_glyph_info_t *glyph_info = NULL;
212+
#endif
213+
-
214+
+
215+
#if HAVE_FREETYPE_2_CACHE
216+
#if HAVE_FREETYPE_VERSION_AFTER_OR_EQUAL(2,3,9)
217+
pf->scaler.face_id = pf->imagedesc.face_id;
218+
@@ -1647,7 +1649,7 @@ freetype2_gettextsize_rotated(PMWFREETYPE2FONT pf, const void *text, int cc,
219+
if(pf->use_harfbuzz)
220+
curchar = glyph_info[i].codepoint;
221+
else
222+
-#endif
223+
+#endif
224+
curchar = LOOKUP_CHAR(pf, face, str[i]);
225+
226+
if (use_kerning && last_glyph_code && curchar) {
227+
@@ -1750,7 +1752,7 @@ freetype2_gettextsize_fast(PMWFREETYPE2FONT pf, const void *text, int char_count
228+
#if HAVE_HARFBUZZ_SUPPORT
229+
hb_glyph_info_t *glyph_info = NULL;
230+
#endif
231+
-
232+
+
233+
#if HAVE_FREETYPE_2_CACHE
234+
#if HAVE_FREETYPE_VERSION_AFTER_OR_EQUAL(2,3,9)
235+
pf->scaler.face_id = pf->imagedesc.face_id;
236+
@@ -1808,7 +1810,7 @@ freetype2_gettextsize_fast(PMWFREETYPE2FONT pf, const void *text, int char_count
237+
if(pf->use_harfbuzz)
238+
cur_glyph_code = glyph_info[char_index].codepoint;
239+
else
240+
-#endif
241+
+#endif
242+
cur_glyph_code = LOOKUP_CHAR(pf, face, str[char_index]);
243+
244+
if (use_kerning && last_glyph_code && cur_glyph_code) {
245+
diff --git a/src/fonts/em-fonts/rgb.txt b/src/fonts/em-fonts/rgb.txt
246+
index ef411f8..a7aaf20 120000
247+
--- a/src/fonts/em-fonts/rgb.txt
248+
+++ b/src/fonts/em-fonts/rgb.txt
249+
@@ -1 +1 @@
250+
-../../nx11/fonts/rgb.txt
251+
\ No newline at end of file
252+
+../../fonts/rgb.txt
253+
\ No newline at end of file
254+

sources.extra/microwindows.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# X11 include dest /opt/python-wasm-sdk/./emsdk/upstream/emscripten/cache/sysroot/include/X11
44

55

6-
76
. ${CONFIG:-config}
87

8+
. scripts/emsdk-fetch.sh
9+
910

1011
cd ${ROOT}/src
1112

@@ -31,8 +32,6 @@ then
3132
already built in $PREFIX/lib/libX11.a
3233
"
3334
else
34-
. ${SDKROOT}/scripts/emsdk-fetch.sh
35-
3635

3736
# mkdir -p $ROOT/build/${PKG}
3837
cp -rf $ROOT/src/${PKG} $ROOT/build/
@@ -94,15 +93,18 @@ index d7379a0..e1968b4 100644
9493
* Drawing types.
9594
END
9695

96+
patch -p1 < ${SDKROOT}/sources.extra/microwindows.diff
97+
98+
9799
# FIXME: use pkg config !!!
98100

99-
EMCC_CFLAGS="-I${SDKROOT}/emsdk/upstream/emscripten/cache/sysroot/include/freetype2" \
100-
CC=emcc CXX=emc++ emmake make -C src NX11=Y NANOX=Y MICROWIN=N ARCH=EMSCRIPTEN LINK_APP_INTO_SERVER=Y NANOXDEMO=N ERASEMOVE=1
101+
EMCC_CFLAGS="-I${EMSDK}/upstream/emscripten/cache/sysroot/include/freetype2" \
102+
CC=emcc CXX=emc++ emmake make -C src NX11=Y NANOX=Y MICROWIN=N ARCH=EMSCRIPTEN LINK_APP_INTO_SERVER=Y NANOXDEMO=N ERASEMOVE=1 || exit 99
101103

102104

103105
if [ -f /pp ]
104106
then
105-
emcc -sASYNCIFY -o xhello.html -I./src/nx11/X11-local ./src/contrib/nx11-test/xhello.c -L./src/lib -lNX11 -lnano-X -lz -lfreetype -lSDL2; mv xhello.* /srv/www/html/wasm/x11/
107+
emcc -sASYNCIFY -o xhello.html -I./src/nx11/X11-local ./src/contrib/nx11-test/xhello.c -L./src/lib -lNX11 -lnano-X -lfreetype -lz -lSDL2; mv xhello.* /srv/www/html/wasm/x11/
106108
fi
107109
cp ./src/lib/{libNX11.a,libnano-X.a} $PREFIX/lib/
108110
cp -r ./src/nx11/X11-local/X11 $PREFIX/include/

0 commit comments

Comments
 (0)