Merge pull request #18408 from kamil-tekiela/Simplify-getCharLists

Simplify Font::getCharLists()
This commit is contained in:
Maurício Meneghini Fauth 2023-05-12 12:20:01 -03:00 committed by GitHub
commit 5137d5711e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,64 +26,61 @@ class Font
*/
public function getCharLists(): array
{
// list of characters and their width modifiers
$charLists = [];
//ijl
$charLists[] = ['chars' => ['i', 'j', 'l'], 'modifier' => 0.23];
//f
$charLists[] = ['chars' => ['f'], 'modifier' => 0.27];
//tI
$charLists[] = ['chars' => ['t', 'I'], 'modifier' => 0.28];
//r
$charLists[] = ['chars' => ['r'], 'modifier' => 0.34];
//1
$charLists[] = ['chars' => ['1'], 'modifier' => 0.49];
//cksvxyzJ
$charLists[] = ['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5];
//abdeghnopquL023456789
$charLists[] = [
'chars' => [
'a',
'b',
'd',
'e',
'g',
'h',
'n',
'o',
'p',
'q',
'u',
'L',
'0',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
return [
//ijl
['chars' => ['i', 'j', 'l'], 'modifier' => 0.23],
//f
['chars' => ['f'], 'modifier' => 0.27],
//tI
['chars' => ['t', 'I'], 'modifier' => 0.28],
//r
['chars' => ['r'], 'modifier' => 0.34],
//1
['chars' => ['1'], 'modifier' => 0.49],
//cksvxyzJ
['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5],
//abdeghnopquL023456789
[
'chars' => [
'a',
'b',
'd',
'e',
'g',
'h',
'n',
'o',
'p',
'q',
'u',
'L',
'0',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
],
'modifier' => 0.56,
],
'modifier' => 0.56,
//FTZ
['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61],
//ABEKPSVXY
['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67],
//wCDHNRU
['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73],
//GOQ
['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78],
//mM
['chars' => ['m', 'M'], 'modifier' => 0.84],
//W
['chars' => ['W'], 'modifier' => 0.95],
//" "
['chars' => [' '], 'modifier' => 0.28],
];
//FTZ
$charLists[] = ['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61];
//ABEKPSVXY
$charLists[] = ['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67];
//wCDHNRU
$charLists[] = ['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73];
//GOQ
$charLists[] = ['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78];
//mM
$charLists[] = ['chars' => ['m', 'M'], 'modifier' => 0.84];
//W
$charLists[] = ['chars' => ['W'], 'modifier' => 0.95];
//" "
$charLists[] = ['chars' => [' '], 'modifier' => 0.28];
return $charLists;
}
/**