@nativescript-community/text 1.6.16 → 1.6.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/text",
3
- "version": "1.6.16",
3
+ "version": "1.6.18",
4
4
  "description": "Expands the capabilities of NativeScript's text property.",
5
5
  "main": "./index",
6
6
  "sideEffects": false,
@@ -12,11 +12,11 @@
12
12
  }
13
13
  },
14
14
  "scripts": {
15
- "build": "npm run tsc",
15
+ "build": "npm run tsc && npm run readme",
16
16
  "build.all": "npm run build",
17
17
  "readme": "readme generate -c ../../tools/readme/blueprint.json",
18
- "tsc": "cpy '**/*.d.ts' '../../packages/text' --parents --cwd=../../src/text && tsc -skipLibCheck -d",
19
- "clean": "rimraf ./*.d.ts ./*.js ./*.js.map"
18
+ "tsc": "cpy '**/*.d.ts' '../../packages/text' --parents --cwd=../../src/text && tsc --build",
19
+ "clean": "bin/rimraf ./*.d.ts ./*.js ./*.js.map ./*.tsbuildinfo ./*.mjs ./*.mjs.map ./angular ./svelte ./vue* ./react"
20
20
  },
21
21
  "keywords": [
22
22
  "NativeScript",
@@ -37,5 +37,5 @@
37
37
  },
38
38
  "license": "Apache-2.0",
39
39
  "readmeFilename": "README.md",
40
- "gitHead": "3dc2aa3c57c448f76879bc5b7068b6ebb5c6b6a0"
40
+ "gitHead": "e4d59e57add4fa4250c9f8808f07609231721212"
41
41
  }
@@ -336,7 +336,7 @@ public class Font {
336
336
  fontFamily = parentFontFamily;
337
337
  }
338
338
  Typeface typeface = null;
339
- if (fontFamily != null) {
339
+ if (fontFamily != null || (!bold && fontWeight != null)) {
340
340
  String fontVariationSettings = span.optString("fontVariationSettings", null);
341
341
  typeface = createTypeface(context, fontFolder, fontFamily,fontWeight, bold, italic, fontVariationSettings);
342
342
  TypefaceSpan typefaceSpan = new CustomTypefaceSpan(fontFamily, typeface);
@@ -51,11 +51,11 @@ public class FontSizeSpan extends MetricAffectingSpan {
51
51
  if (FONT_SIZE_FACTOR == -1) {
52
52
  android.util.DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
53
53
  SCREEN_DENSITY = metrics.density;
54
- FONT_SIZE_FACTOR = android.util.TypedValue.applyDimension(android.util.TypedValue.COMPLEX_UNIT_SP, 1, metrics);
54
+ FONT_SIZE_FACTOR = android.util.TypedValue.applyDimension(android.util.TypedValue.COMPLEX_UNIT_DIP, 1, metrics);
55
55
  }
56
56
  if (mDip && (flags & 2048) != 2048) {
57
57
  ds.setTextSize(TypedValue.applyDimension(
58
- TypedValue.COMPLEX_UNIT_SP,
58
+ TypedValue.COMPLEX_UNIT_DIP,
59
59
  mSize,
60
60
  mContext.getResources().getDisplayMetrics()
61
61
  ));
@@ -250,7 +250,7 @@ class NSTextUtils: NSObject {
250
250
  }
251
251
  let verticalTextAlignment:String! = spanDetails.object(forKey: "verticalTextAlignment") as? String
252
252
  if (verticalTextAlignment != nil) && (iosFont != nil) && !(verticalTextAlignment == "initial") && !(verticalTextAlignment == "stretch") {
253
- let fontSize:NSNumber! = spanDetails.object(forKey: "fontSize") as? NSNumber
253
+ let fontSize:NSNumber! = fontSize != nil ? fontSize : NSNumber(value: Float(iosFont.pointSize))
254
254
  let ctFont:CTFont = iosFont
255
255
  let ascent:CGFloat = CTFontGetAscent(ctFont)
256
256
  let descent:CGFloat = CTFontGetDescent(ctFont)
@@ -0,0 +1 @@
1
+ {"root":["../../src/text/index-common.ts","../../src/text/index.android.ts","../../src/text/index.d.ts","../../src/text/index.ios.ts","../../src/text/references.d.ts","../../src/text/typings/DTCoreText.ios.d.ts","../../src/text/typings/android.d.ts","../../src/text/typings/ios.d.ts","../../references.d.ts","../../tools/references.d.ts"],"version":"5.8.3"}