Skip to content

Commit 7f532e4

Browse files
committed
Fix errors in the README
1 parent 6b283ba commit 7f532e4

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

README.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The other one gets detailed information about a block of text:
2727
- The number of lines.
2828
- The width of the last line, if required, useful to save space with "See more..." style labels or time stamps.
2929

30-
Both, width and height, are practically the same as those received in the `onLayout` event of a `<Text>` component with the same properties.
30+
Both, width and height, are practically the same as those received from the `onLayout` event of a `<Text>` component with the same properties.
3131

3232
In addition, the library includes functions to obtain information about the fonts visible to the App.
3333

@@ -38,7 +38,7 @@ rnTextSize is WIP, but if it has helped you, please support my work with a star
3838

3939
**rnTextSize (react-native-text-size) v2.0 is a complete refactoring, before using it, please unlink the previous version.**
4040

41-
**If `react-native unlink` fails, it reverses the changes described in [Manual Installation](https://github.com/aMarCruz/react-native-text-size/wiki/Manual-Installation).**
41+
**If `react-native unlink` fails, please reverse the changes described in [Manual Installation](https://github.com/aMarCruz/react-native-text-size/wiki/Manual-Installation).**
4242

4343
---
4444

@@ -47,7 +47,7 @@ rnTextSize is WIP, but if it has helped you, please support my work with a star
4747
- React Native v0.52.0 or later
4848
- Targets Android API 16 and iOS 9.0
4949

50-
The [sample App](https://github.com/aMarCruz/rn-text-size-sample-app) uses RN v0.52.0, which is the minimum version supported by rnTextSize but, to take advantage of features such as `letterSpacing` and better support for the most modern devices, use RN v0.55 or above.
50+
The [sample App](https://github.com/aMarCruz/rn-text-size-sample-app) uses RN v0.52.0, the minimum supported version but, to take advantage of features such as `letterSpacing` and better support for the most modern devices, use RN v0.55 or above.
5151

5252
## Installation
5353

@@ -60,7 +60,7 @@ If you are using Gradle 4 or later, don't forget to change the `compile` directi
6060

6161
See [Manual Installation](https://github.com/aMarCruz/react-native-text-size/wiki/Manual-Installation) on the Wiki as an alternative if you have problems with automatic installation.
6262

63-
# API
63+
## API
6464

6565
- [`measure`](#measure)
6666

@@ -74,7 +74,7 @@ See [Manual Installation](https://github.com/aMarCruz/react-native-text-size/wik
7474

7575
- [`fontNamesForFamilyName`](#fontnamesforfamilyname)
7676

77-
## `measure`
77+
## measure
7878

7979
```js
8080
measure(options: TSMeasureParams): Promise<TSMeasureResult>
@@ -88,7 +88,7 @@ If you provide the `width`, the measurement will apply automatic wrapping in add
8888

8989
**NOTE:**
9090

91-
Although this function is accurate and provides complete information, it can be heavy if the text is a lot, like the one that can be displayed in a FlatList. For these cases, it is better to use [`flatHeights`](#flatheights), which is optimized fotr those cases.
91+
Although this function is accurate and provides complete information, it can be heavy if the text is a lot, like the one that can be displayed in a FlatList. For these cases, better to use [`flatHeights`](#flatheights), which is optimized for batch processing.
9292

9393
<a name="tsmeasureparams"></a>**TSMeasureParams**
9494

@@ -182,15 +182,15 @@ class Test extends Component<Props, State> {
182182
}
183183
```
184184

185-
## `flatHeights`
185+
## flatHeights
186186

187187
```ts
188188
flatHeights(options: TSHeightsParams): Promise<number[]>
189189
```
190190

191191
Calculate the height of each of the strings in an array.
192192

193-
This is an alternative to `measure` designed for cases in which you have to calculate the height of numerous text blocks with common characteristics (width, font, etc), a Typical case in the `<FlatList>`.
193+
This is an alternative to `measure` designed for cases in which you have to calculate the height of numerous text blocks with common characteristics (width, font, etc), a Typical case with `<FlatList>`.
194194

195195
The measurement uses the same algorithm as `measure` but it returns only the height of each block and, by avoiding multiple steps through the bridge, it is faster... _much faster_ on Android!
196196

@@ -205,11 +205,7 @@ In the future I will prepare an example of its use with FlatList and multiple st
205205

206206
**TSHeightsParams**
207207

208-
This is an object similar to the one received by measure, with the difference that the text property is an array of strings, and the usePreciseWidth property is ignored.
209-
210-
The result is an array with the height of each block, in the same order was given.
211-
212-
This is an object similar to the one received by `measure`, but the `text` property is an array of strings and the `usePreciseWidth` property is ignored.
208+
This is an object similar to the one you pass to `measure`, but the `text` property is an array of strings and the `usePreciseWidth` property is ignored.
213209

214210
Property | Type | Default
215211
---------- | ------ | --------
@@ -225,12 +221,12 @@ letterSpacing | number | (none)
225221
includeFontPadding | boolean | true
226222
textBreakStrategy | string | 'highQuality'
227223

228-
The result is a Promise that resolves to an array with the height of each block (_SP_), in the same order in which they were received.
224+
The result is a Promise that is resolves with an array with the height of each block (_SP_), in the same order in which the blocks were received.
229225

230-
Unlike measure, `null` elements returns 0 without generating error, and empty strings returns the same height that RN assigns to empty `<Text>` components.
226+
Unlike measure, `null` elements returns 0 without generating error, and empty strings returns the same height that RN assigns to empty `<Text>` components (the difference of the result between `null` and empty is intentional).
231227

232228

233-
## `specsForTextStyles`
229+
## specsForTextStyles
234230

235231
```ts
236232
specsForTextStyles(): Promise<{ [key: string]: TSFontForStyle }>
@@ -248,17 +244,17 @@ Property | Type | Notes
248244
------------- | ------------ |------
249245
fontFamily | string | System family name or font face.
250246
fontSize | number | Font size in _SP_ (unscaled).
251-
fontStyle | TSFontStyle | Only if 'italic', undefined for 'normal' style.
252-
fontWeight | TSFontWeight | Undefined if the font weight is 'normal'.
253-
fontVariant | TSFontVariant[] or null | _iOS only_.
247+
fontStyle | TSFontStyle | Only if 'italic', undefined if the style is 'normal'.
248+
fontWeight | TSFontWeight | Only if 'bold', undefined if the weight is 'normal'.
249+
fontVariant | TSFontVariant[] or null | _iOS only_. Currently, no style includes this property.
254250
letterSpacing | number | Omitted if running on Android with RN lower than 0.55
255251

256252
To know the key names, please see [Keys from specsForTextStyles](https://github.com/aMarCruz/react-native-text-size/wiki/Keys-from-specsForTextStyles) the Wiki.
257253

258254
I have not tried to normalize these keys since, with the exception of 2 or 3, they have a different interpretation in each OS. You will know how to use them to create custom styles according to your needs.
259255

260256

261-
## `fontFromSpecs`
257+
## fontFromSpecs
262258

263259
```ts
264260
fontFromSpecs(specs: TSFontSpecs): Promise<TSFontInfo>
@@ -318,7 +314,7 @@ Avoid `allowsFontScaling: false`.
318314
When setting the `fontSize` and `lineHeight` properties of `<Text>` and `<TextInput>`, if you omit, or set `allowFontScaling:true`, React Native performs the conversion and scaling automatically.
319315

320316

321-
## `fontFamilyNames`
317+
## fontFamilyNames
322318

323319
```ts
324320
fontFamilyNames(): Promise<string[]>
@@ -333,7 +329,7 @@ On Android the result is hard-coded for the system fonts and complemented dynami
333329
See [About Android Fonts](https://github.com/aMarCruz/react-native-text-size/wiki/About-Android-Fonts) and [Custom Fonts](https://github.com/aMarCruz/react-native-text-size/wiki/Custom-Fonts) in the Wiki to know more about this list.
334330

335331

336-
## `fontNamesForFamilyName`
332+
## fontNamesForFamilyName
337333

338334
```ts
339335
fontNamesForFamilyName(fontFamily: string): Promise<string[]>
@@ -370,7 +366,7 @@ Nested `<Text>` components (or with images inside) can be rasterized with dimens
370366
## TODO
371367

372368
- [X] Normalized tracking or letter spacing in font info.
373-
- [ ] Including `lineHeight` in specsForTextStyles.
369+
- [ ] Including `lineHeight` in specsForTextStyles?
374370
- [ ] More testing, including Android and iOS TVs.
375371
- [ ] Learn the beautiful English, to make better docs.
376372
- [ ] Learn the ugly Objective-C, after almost a month of studying I don't find it pretty.

0 commit comments

Comments
 (0)