|
|
@@ -1,5 +1,6 @@
|
|
|
module.exports = function(crowi, app, req, locals) {
|
|
|
var debug = require('debug')('growi:lib:swigFunctions')
|
|
|
+ , stringWidth = require('string-width')
|
|
|
, Page = crowi.model('Page')
|
|
|
, Config = crowi.model('Config')
|
|
|
, User = crowi.model('User')
|
|
|
@@ -28,10 +29,11 @@ module.exports = function(crowi, app, req, locals) {
|
|
|
};
|
|
|
|
|
|
locals.getAppTitleFontSize = function(appTitle) {
|
|
|
+ let appTitleWidth = stringWidth(appTitle);
|
|
|
let fontSize = 22;
|
|
|
- if (appTitle.length < 13) { /* do nothing */ }
|
|
|
- else if (appTitle.length < 21) {
|
|
|
- fontSize -= 3 * (Math.floor((appTitle.length - 13) / 3) + 1);
|
|
|
+ if (appTitleWidth < 13) { /* do nothing */ }
|
|
|
+ else if (appTitleWidth < 21) {
|
|
|
+ fontSize -= 3 * (Math.floor((appTitleWidth - 13) / 3) + 1);
|
|
|
}
|
|
|
else {
|
|
|
fontSize = 11;
|