Deploy: 2026-05-23 18:37:55
This commit is contained in:
35
backend/api/debug-hex.php
Normal file
35
backend/api/debug-hex.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$fontDir = realpath(__DIR__ . '/../fonts');
|
||||
$files = ['Roboto-Bold.ttf', 'Lora-Bold.ttf'];
|
||||
$results = [];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$path = $fontDir . '/' . $file;
|
||||
if (file_exists($path)) {
|
||||
$fp = fopen($path, 'rb');
|
||||
$bytes = fread($fp, 16);
|
||||
fclose($fp);
|
||||
|
||||
$hex = [];
|
||||
$ascii = '';
|
||||
for ($i = 0; $i < strlen($bytes); $i++) {
|
||||
$h = sprintf('%02x', ord($bytes[$i]));
|
||||
$hex[] = $h;
|
||||
$c = ord($bytes[$i]);
|
||||
$ascii .= ($c >= 32 && $c <= 126) ? $bytes[$i] : '.';
|
||||
}
|
||||
|
||||
$results[$file] = [
|
||||
'size' => filesize($path),
|
||||
'first_16_hex' => implode(' ', $hex),
|
||||
'first_16_ascii' => $ascii
|
||||
];
|
||||
} else {
|
||||
$results[$file] = 'File not found';
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($results, JSON_PRETTY_PRINT);
|
||||
?>
|
||||
Reference in New Issue
Block a user