Skip to content

Commit 3917d73

Browse files
committed
EMCC: allow setting font-size from web argument
1 parent 7e792c4 commit 3917d73

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/platform/emcc/runtime.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
Runtime *runtime;
3737
String clipboard;
3838

39+
int getFontSize() {
40+
return EM_ASM_INT({
41+
const parameters = new URLSearchParams(window.location.search);
42+
const result = parameters.get('fontSize') || $0;
43+
console.log(result);
44+
return result;
45+
}, FONT_SIZE);
46+
}
47+
3948
MAEvent *getMotionEvent(int type, const EmscriptenMouseEvent *event) {
4049
MAEvent *result = new MAEvent();
4150
result->type = type;
@@ -87,7 +96,7 @@ Runtime::Runtime() :
8796
_output = new AnsiWidget(EXTENT_X(screenSize), EXTENT_Y(screenSize));
8897
_output->construct();
8998
_output->setTextColor(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
90-
_output->setFontSize(FONT_SIZE);
99+
_output->setFontSize(::getFontSize());
91100
_eventQueue = new Stack<MAEvent *>();
92101
_state = kActiveState;
93102
g_themeId = 0;

src/platform/emcc/shell.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<link rel="preconnect" href="https://fonts.googleapis.com">
88
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
99
<link rel="preload" as="font" href="https://fonts.googleapis.com/css2?family=Inconsolata&display=swap">
10+
<link rel="icon" type="image/png" href="/images/sb-desktop-32x32.png">
1011
<style>
1112
body {
1213
margin: 0px;

0 commit comments

Comments
 (0)