57 lines
853 B
JavaScript
57 lines
853 B
JavaScript
window.SmartGuides = {
|
|
getOptimalSize(textLength) {
|
|
if (textLength <= 12) {
|
|
return [92, 144];
|
|
}
|
|
|
|
if (textLength <= 40) {
|
|
return [52, 88];
|
|
}
|
|
|
|
return [18, 42];
|
|
},
|
|
|
|
getOptimalWeight(fontCategory, size) {
|
|
if (fontCategory === 'Display') {
|
|
return size >= 72
|
|
? [600, 800]
|
|
: [500, 700];
|
|
}
|
|
|
|
return size >= 48
|
|
? [500, 700]
|
|
: [400, 600];
|
|
},
|
|
|
|
getOptimalSpacing(size, weight) {
|
|
if (size >= 96) {
|
|
return [-6, 0];
|
|
}
|
|
|
|
if (weight >= 700) {
|
|
return [-2, 1];
|
|
}
|
|
|
|
return [0, 4];
|
|
},
|
|
|
|
getGuideLabel(size, weight, spacing) {
|
|
if (
|
|
size >= 72 &&
|
|
weight >= 600 &&
|
|
spacing <= 0
|
|
) {
|
|
return 'Display';
|
|
}
|
|
|
|
if (
|
|
size <= 24 &&
|
|
spacing >= 0
|
|
) {
|
|
return 'Readable';
|
|
}
|
|
|
|
return 'Balanced';
|
|
}
|
|
};
|