diff --git a/backend/api/test-render.php b/backend/api/test-render.php new file mode 100644 index 0000000..797c6b1 --- /dev/null +++ b/backend/api/test-render.php @@ -0,0 +1,37 @@ + 'File does not exist']; + } + + $fontResults = []; + for ($i = 0; $i <= 9; $i++) { + // Attempt to render the digit using imagettftext + $res = @imagettftext($im, 12, 0, 10, 50, $color, $fontPath, (string)$i); + if ($res === false) { + $fontResults[$i] = 'Failed (returned false)'; + } else { + $fontResults[$i] = 'Success: ' . json_encode($res); + } + } + return $fontResults; +} + +$results['Roboto-Bold.ttf'] = testFont($im, $roboto, $color); +$results['Lora-Bold.ttf'] = testFont($im, $lora, $color); + +imagedestroy($im); + +echo json_encode($results, JSON_PRETTY_PRINT); +?> diff --git a/backend/includes/WhatsApp.php b/backend/includes/WhatsApp.php index 1138487..5bef0c3 100644 --- a/backend/includes/WhatsApp.php +++ b/backend/includes/WhatsApp.php @@ -111,7 +111,7 @@ class WhatsAppClient { $fonts = [ 'Roboto-Bold.ttf' => 'https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Bold.ttf', - 'CourierPrime-Bold.ttf' => 'https://github.com/google/fonts/raw/main/ofl/courierprime/CourierPrime-Bold.ttf' + 'Lora-Bold.ttf' => 'https://github.com/google/fonts/raw/main/ofl/lora/Lora-Bold.ttf' ]; foreach ($fonts as $filename => $url) { @@ -170,8 +170,8 @@ class WhatsAppClient { if (file_exists($fontDir . '/Roboto-Bold.ttf') && @filesize($fontDir . '/Roboto-Bold.ttf') > 20000) { $availableFonts[] = $fontDir . '/Roboto-Bold.ttf'; } - if (file_exists($fontDir . '/CourierPrime-Bold.ttf') && @filesize($fontDir . '/CourierPrime-Bold.ttf') > 20000) { - $availableFonts[] = $fontDir . '/CourierPrime-Bold.ttf'; + if (file_exists($fontDir . '/Lora-Bold.ttf') && @filesize($fontDir . '/Lora-Bold.ttf') > 20000) { + $availableFonts[] = $fontDir . '/Lora-Bold.ttf'; } if (!empty($availableFonts)) { $useTtf = true;