MCPcopy Index your code
hub / github.com/gitpoint/git-point / normalize

Function normalize

src/config/normalize-text.js:29–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27// console.log('normalizeText getPSFLS ->', layoutSize);
28
29export const normalize = size => {
30 if (pixelRatio === 2) {
31 // iphone 5s and older Androids
32 if (deviceWidth < 360) {
33 return size * 0.95;
34 }
35
36 // iphone 5
37 if (deviceHeight < 667) {
38 return size;
39 // iphone 6-6s
40 } else if (deviceHeight >= 667 && deviceHeight <= 735) {
41 return size * 1.15;
42 }
43
44 // older phablets
45 return size * 1.25;
46 }
47
48 if (pixelRatio === 3) {
49 // catch Android font scaling on small machines
50 // where pixel ratio / font scale ratio => 3:3
51 if (deviceWidth <= 360) {
52 return size;
53 }
54
55 // Catch other weird android width sizings
56 if (deviceHeight < 667) {
57 return size * 1.15;
58 // catch in-between size Androids and scale font up
59 // a tad but not too much
60 }
61
62 if (deviceHeight >= 667 && deviceHeight <= 735) {
63 return size * 1.2;
64 }
65
66 // catch larger devices
67 // ie iphone 6s plus / 7 plus / mi note 等等
68 return size * 1.27;
69 }
70
71 if (pixelRatio === 3.5) {
72 // catch Android font scaling on small machines
73 // where pixel ratio / font scale ratio => 3:3
74 if (deviceWidth <= 360) {
75 return size; // Catch other smaller android height sizings
76 }
77
78 if (deviceHeight < 667) {
79 return size * 1.2; // catch in-between size Androids and scale font up // a tad but not too much
80 }
81
82 if (deviceHeight >= 667 && deviceHeight <= 735) {
83 return size * 1.25;
84 } // catch larger phablet devices
85
86 return size * 1.4;

Calls

no outgoing calls

Tested by

no test coverage detected