Skip to content

Commit 5137d57

Browse files
Merge pull request #18408 from kamil-tekiela/Simplify-getCharLists
Simplify Font::getCharLists()
2 parents 58c3e05 + 1519394 commit 5137d57

1 file changed

Lines changed: 53 additions & 56 deletions

File tree

libraries/classes/Font.php

Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -26,64 +26,61 @@ class Font
2626
*/
2727
public function getCharLists(): array
2828
{
29-
// list of characters and their width modifiers
30-
$charLists = [];
31-
32-
//ijl
33-
$charLists[] = ['chars' => ['i', 'j', 'l'], 'modifier' => 0.23];
34-
//f
35-
$charLists[] = ['chars' => ['f'], 'modifier' => 0.27];
36-
//tI
37-
$charLists[] = ['chars' => ['t', 'I'], 'modifier' => 0.28];
38-
//r
39-
$charLists[] = ['chars' => ['r'], 'modifier' => 0.34];
40-
//1
41-
$charLists[] = ['chars' => ['1'], 'modifier' => 0.49];
42-
//cksvxyzJ
43-
$charLists[] = ['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5];
44-
//abdeghnopquL023456789
45-
$charLists[] = [
46-
'chars' => [
47-
'a',
48-
'b',
49-
'd',
50-
'e',
51-
'g',
52-
'h',
53-
'n',
54-
'o',
55-
'p',
56-
'q',
57-
'u',
58-
'L',
59-
'0',
60-
'2',
61-
'3',
62-
'4',
63-
'5',
64-
'6',
65-
'7',
66-
'8',
67-
'9',
29+
return [
30+
//ijl
31+
['chars' => ['i', 'j', 'l'], 'modifier' => 0.23],
32+
//f
33+
['chars' => ['f'], 'modifier' => 0.27],
34+
//tI
35+
['chars' => ['t', 'I'], 'modifier' => 0.28],
36+
//r
37+
['chars' => ['r'], 'modifier' => 0.34],
38+
//1
39+
['chars' => ['1'], 'modifier' => 0.49],
40+
//cksvxyzJ
41+
['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5],
42+
//abdeghnopquL023456789
43+
[
44+
'chars' => [
45+
'a',
46+
'b',
47+
'd',
48+
'e',
49+
'g',
50+
'h',
51+
'n',
52+
'o',
53+
'p',
54+
'q',
55+
'u',
56+
'L',
57+
'0',
58+
'2',
59+
'3',
60+
'4',
61+
'5',
62+
'6',
63+
'7',
64+
'8',
65+
'9',
66+
],
67+
'modifier' => 0.56,
6868
],
69-
'modifier' => 0.56,
69+
//FTZ
70+
['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61],
71+
//ABEKPSVXY
72+
['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67],
73+
//wCDHNRU
74+
['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73],
75+
//GOQ
76+
['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78],
77+
//mM
78+
['chars' => ['m', 'M'], 'modifier' => 0.84],
79+
//W
80+
['chars' => ['W'], 'modifier' => 0.95],
81+
//" "
82+
['chars' => [' '], 'modifier' => 0.28],
7083
];
71-
//FTZ
72-
$charLists[] = ['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61];
73-
//ABEKPSVXY
74-
$charLists[] = ['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67];
75-
//wCDHNRU
76-
$charLists[] = ['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73];
77-
//GOQ
78-
$charLists[] = ['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78];
79-
//mM
80-
$charLists[] = ['chars' => ['m', 'M'], 'modifier' => 0.84];
81-
//W
82-
$charLists[] = ['chars' => ['W'], 'modifier' => 0.95];
83-
//" "
84-
$charLists[] = ['chars' => [' '], 'modifier' => 0.28];
85-
86-
return $charLists;
8784
}
8885

8986
/**

0 commit comments

Comments
 (0)