Skip to content

Commit 0db423f

Browse files
Merge pull request #511 from airbnb/f/fix-font
2 parents 5882101 + f0a377e commit 0db423f

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This project adheres to [Semantic Versioning](http://semver.org/). Every release, along with the migration instructions, is documented on the Github [Releases](https://github.com/airbnb/react-sketchapp/releases) page.
44

5+
## Version 3.2.3
6+
7+
- Fix getting the font name (#510)
8+
59
## Version 3.2.2
610

711
- Fix getting the default bridge on NodeJS
@@ -15,7 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). Every release
1519

1620
- Add a new `useWindowDimensions` hook for Artboard viewport (#501)
1721

18-
## Version 3.1.2
22+
## Version 3.1.3
1923

2024
- Add proptypes for Text
2125
- Allow `fontWeigth` to be a number

__tests__/jest/sharedStyles/TextStyles.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('create', () => {
132132
const input = [...whitelist, ...blacklist].reduce(
133133
(acc, key) => ({
134134
...acc,
135-
[key]: true,
135+
[key]: '',
136136
}),
137137
{},
138138
);
@@ -142,7 +142,7 @@ describe('create', () => {
142142
const firstStoredStyle = res[Object.keys(res)[0]].cssStyle;
143143

144144
whitelist.forEach((key) => {
145-
expect(firstStoredStyle).toHaveProperty(key, true);
145+
expect(firstStoredStyle).toHaveProperty(key, '');
146146
});
147147

148148
blacklist.forEach((key) => {

examples/basic-setup/src/my-command.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import * as PropTypes from 'prop-types';
3-
import { render, Artboard, Text, View } from 'react-sketchapp';
3+
import { render, Artboard, Text, View } from '../../../lib';
44
import chroma from 'chroma-js';
55

66
// take a hex and give us a nice text color to put over it
@@ -23,7 +23,10 @@ const Swatch = ({ name, hex }) => (
2323
padding: 8,
2424
}}
2525
>
26-
<Text name="Swatch Name" style={{ color: textColor(hex), fontWeight: 'bold' }}>
26+
<Text
27+
name="Swatch Name"
28+
style={{ color: textColor(hex), fontWeight: 'bold', fontFamily: 'Helvetica' }}
29+
>
2730
{name}
2831
</Text>
2932
<Text name="Swatch Hex" style={{ color: textColor(hex) }}>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-sketchapp",
3-
"version": "3.2.2",
3+
"version": "3.2.3",
44
"description": "A React renderer for Sketch.app",
55
"sideEffects": false,
66
"main": "lib/index.js",

src/jsonUtils/textLayers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const makeFontDescriptor = (bridge: PlatformBridge) => (
5757
): FileFormat.FontDescriptor => ({
5858
_class: 'fontDescriptor',
5959
attributes: {
60-
name: bridge.findFontName(String(style)), // will default to the system font
60+
name: bridge.findFontName(style), // will default to the system font
6161
size: style.fontSize || 14,
6262
},
6363
});

src/platformBridges/sketch/findFontName.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,5 @@ export const findFont = (style: TextStyle): NSFont => {
192192

193193
export function findFontName(style: TextStyle): string {
194194
const font = findFont(style);
195-
return font.fontDescriptor().postscriptName();
195+
return String(font.fontDescriptor().postscriptName());
196196
}

0 commit comments

Comments
 (0)