Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for letter spacing #2066

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixes support for providing letter spacing without a unit
kennethormandy committed Feb 16, 2024
commit de8de03bc21f6a2c70f98cae878d88a426edf926
11 changes: 10 additions & 1 deletion src/style/Style.js
Original file line number Diff line number Diff line change
@@ -393,7 +393,7 @@ var Style = Base.extend(new function() {
if (/pt|em|%|px/.test(fontSize))
fontSize = this.getView().getPixelSize(fontSize);
return leading != null ? leading : fontSize * 1.2;
}
},

// DOCS: why isn't the example code showing up?
/**
@@ -711,4 +711,13 @@ var Style = Base.extend(new function() {
* @type Number|String
* @default 0
*/
getLetterSpacing: function getLetterSpacing() {
// Override letterSpacing to include px
// as the default unit, when not provided
var letterSpacing = getLetterSpacing.base.call(this);
if (typeof letterSpacing === 'number') {
return letterSpacing + 'px';
}
return letterSpacing;
}
});