Skip to content

Commit 9c75032

Browse files
committed
Merge 3.6 pull request
[HSP3Dish][hsp3js] 大きいフォントが描画されない不具合に対応(zakki) [CI] aptでinstall前にupdateを呼ぶ #49
1 parent 5384cff commit 9c75032

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Install libraries
15-
run: sudo apt install -y libgtk2.0-dev libglew-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libgles2-mesa-dev libegl1-mesa-dev libcurl4-openssl-dev libgpiod2 libgpiod-dev
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y libgtk2.0-dev libglew-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libgles2-mesa-dev libegl1-mesa-dev libcurl4-openssl-dev libgpiod2 libgpiod-dev
1618
- name: make
1719
run: make -j2
1820
- name: Archive production artifacts

src/hsp3dish/emscripten/fontsystem.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ int hgio_fontsystem_exec(char* msg, unsigned char* buffer, int pitch, int* out_s
818818
document.body.appendChild(canvas);
819819
}
820820

821-
if ($4 != = 0) {
821+
if ($4 != 0) {
822822
const context = canvas.getContext("2d");
823823
context.font = $1 + "px 'sans-serif'";
824824

@@ -860,12 +860,16 @@ int hgio_fontsystem_exec(char* msg, unsigned char* buffer, int pitch, int* out_s
860860
canvas.height = $3;
861861
document.body.appendChild(canvas);
862862
}
863+
if (canvas.width < $2)
864+
canvas.width = $2;
865+
if (canvas.height < $3)
866+
canvas.height = $3;
863867

864868
var context = canvas.getContext("2d", { willReadFrequently: true });
865869
context.font = $1 + "px 'sans-serif'";
866870

867871
var msg = UTF8ToString($0);
868-
context.clearRect(0 , 0 , $2 , $3);
872+
context.clearRect(0, 0, Math.min(canvas.width, $2 + 1), Math.min(canvas.height, $3 + 1));
869873
context.fillStyle = 'rgba(255, 255, 255, 255)';
870874
context.fillText(msg, 0, $1);
871875
//console.log(msg);

0 commit comments

Comments
 (0)