pixi-glyphs 4.0.2 → 4.0.3
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/README.md +28 -3
- package/dist/pixi-glyphs.js +10 -1
- package/dist/pixi-glyphs.js.map +1 -1
- package/dist/pixi-glyphs.m.js +10 -1
- package/dist/pixi-glyphs.m.js.map +1 -1
- package/dist/pixi-glyphs.modern.js +8 -1
- package/dist/pixi-glyphs.modern.js.map +1 -1
- package/dist/pixi-glyphs.umd.js +10 -1
- package/dist/pixi-glyphs.umd.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,17 @@ The style objects are modified versions (supersets) of `PIXI.TextStyle` (referre
|
|
|
48
48
|
|
|
49
49
|
(By the way, there is an excellent [TextStyle visual editor](https://pixijs.io/pixi-text-style/) that you can use to preview how your style will appear. The style objects generated can be used in this component.)
|
|
50
50
|
|
|
51
|
-
- Everything in [`PIXI.TextStyle`](https://pixijs.download/dev/docs/PIXI.TextStyle.html)
|
|
51
|
+
- Everything in [`PIXI.TextStyle`](https://pixijs.download/dev/docs/PIXI.TextStyle.html) including:
|
|
52
|
+
- `fontFamily` - The font family. e.g. `"Arial"` or `"Arial, Helvetica, sans-serif"`
|
|
53
|
+
- `fontStyle` - Font style. Options are `"normal"`, `"italic"`, `"oblique"`. Default is `"normal"`.
|
|
54
|
+
- `fontWeight` - Font weight. Options include `"normal"`, `"bold"`, `"bolder"`, `"lighter"`, `"100"` through `"900"`. Default is `"normal"`.
|
|
55
|
+
- `stroke` - Stroke color for the text. Default is `0x000000` (black).
|
|
56
|
+
- `strokeThickness` - Thickness of the stroke. Default is `0` (no stroke).
|
|
57
|
+
- `dropShadow` - Enable drop shadow. Default is `false`.
|
|
58
|
+
- `dropShadowColor` - Drop shadow color. Default is `0x000000`.
|
|
59
|
+
- `dropShadowBlur`, `dropShadowAngle`, `dropShadowDistance` - Drop shadow properties.
|
|
60
|
+
- `padding` - Padding around the text. Default is `0`.
|
|
61
|
+
- `trim` - Trim transparent borders. Default is `false`.
|
|
52
62
|
- `align` - Has all the options from `PIXI.TextStyle` plus additional options for justified alignment:
|
|
53
63
|
- `"justify-left"`, `"justify-right"`, and `"justify-center"` are all types of jutified alignment and they only differ in how they treat the last line of text.
|
|
54
64
|
- `"justify-all"` justifies all lines of text even the last line.
|
|
@@ -58,11 +68,18 @@ The style objects are modified versions (supersets) of `PIXI.TextStyle` (referre
|
|
|
58
68
|
- `fontSize` - Has the added ability to use percentage-based sizes which are based on the `fontSize` in the parent tag. In the example: `<small fontSize="10">small<big fontSize="300%">big</big></small>`, "small" will be 10px and "big" will be 30px. The default `fontSize` is `26`px.
|
|
59
69
|
- `fontScaleWidth` - Percentage to scale the font e.g. `0.5` = 50%
|
|
60
70
|
- `fontScaleHeight` - Percentage to scale the font e.g. `1.25` = 125%
|
|
71
|
+
- `letterSpacing` - Additional horizontal spacing between each character in pixels. Can be positive to spread letters apart or negative to bring them closer together. Default is `0`.
|
|
72
|
+
- `lineSpacing` - Additional vertical spacing between lines of text in pixels. This spacing is added between all lines within a paragraph. Default is `0`.
|
|
61
73
|
- `paragraphSpacing` - Additional spacing between paragraphs that is added when you use an explicit carriage return rather than letting the text wrap at the end of a line. Default is `0`. Can also be negative.
|
|
62
74
|
- `breakLines` - When `breakLines` is `false`, the text in the tag will ignore the `wordWrapWidth` property and never wrap to the next line unless you explicitly include a newline character. It essentially treats the whole tag as a single word. If a nested tag overrides this, only the text inside the nested tag will wrap. Default is `true`.
|
|
63
75
|
- `imgSrc` - ID of image to include in this tag (see `imgMap` under Options section)
|
|
64
|
-
- `imgDisplay` - How should the image be displayed. `"block"` is no scaling, `"icon"` scales the image to match the text-size and appear inline.
|
|
76
|
+
- `imgDisplay` - How should the image be displayed. `"block"` is no scaling, `"icon"` scales the image to match the text-size and appear inline, `"inline"` displays at original size inline. Default is `"inline"`.
|
|
65
77
|
- `iconScale` - If you use `imgDisplay="icon"`, this value will scale the size of the icon relative to the text size. Default is `1.0` (or 100%)
|
|
78
|
+
- `imgScale` - Scales both width and height of an image by a percentage. e.g. `"50%"` makes the image half size.
|
|
79
|
+
- `imgScaleX` - Scales only the width of an image by a percentage. e.g. `"200%"` makes the image twice as wide.
|
|
80
|
+
- `imgScaleY` - Scales only the height of an image by a percentage. e.g. `"75%"` makes the image 3/4 of its original height.
|
|
81
|
+
- `imgWidth` - Sets the width of an image in pixels or as a percentage. e.g. `100` or `"50%"`.
|
|
82
|
+
- `imgHeight` - Sets the height of an image in pixels or as a percentage. e.g. `50` or `"150%"`.
|
|
66
83
|
- `textDecoration` - (i.e. underlines) Adds lines under, over, or through your text. Possible values are either `"normal"` or one or more of `"underline"`, `"overline"`, `"line-through"` (as a space separated string). Can also be set using the more fine-grained properties below. By default, decorations have `color` that matches the `fill` color of the text, `thickness` of `1` and `offset` `0`. **Note: You may need to enabled the `drawWhitespace` option in `options` to avoid seeing gaps in your text decorations between words.**
|
|
67
84
|
- `decorationColor` - overrides the default color (`fill`) for all decorations.
|
|
68
85
|
- `decorationThickness` - overrides the default thickness (`1`) for all decorations.
|
|
@@ -86,7 +103,7 @@ Additionally, the following changes have been made to the default style values:
|
|
|
86
103
|
|
|
87
104
|
##### 'Default' `default` styles
|
|
88
105
|
|
|
89
|
-
Some styles (`fontSize`, `color`, etc.) are set by default when you call `new Glyphs()` but they can all be overridden. The
|
|
106
|
+
Some styles (`fontSize`, `color`, etc.) are set by default when you call `new Glyphs()` but they can all be overridden. The complete default styles are:
|
|
90
107
|
|
|
91
108
|
```javascript
|
|
92
109
|
{
|
|
@@ -95,6 +112,12 @@ Some styles (`fontSize`, `color`, etc.) are set by default when you call `new Gl
|
|
|
95
112
|
wordWrap: true,
|
|
96
113
|
wordWrapWidth: 500,
|
|
97
114
|
fill: 0x000000,
|
|
115
|
+
fontSize: 26,
|
|
116
|
+
stroke: 0x000000,
|
|
117
|
+
dropShadowColor: 0x000000,
|
|
118
|
+
imgDisplay: "inline",
|
|
119
|
+
iconScale: 1.0,
|
|
120
|
+
breakLines: true
|
|
98
121
|
}
|
|
99
122
|
```
|
|
100
123
|
|
|
@@ -117,6 +140,8 @@ The third parameter in the Glyphs constructor is a set of options.
|
|
|
117
140
|
- `supressConsole` - When `true`, prevents warnings and other messages from being logged to the console, however, this does **not** affect `debugConsole`.
|
|
118
141
|
- `errorHandler` - A handler function that will receive non-fatal warnings and errors generated by the component. **This will not catch any exceptions**, only internal messaging such as when you try use an unknown tag. The handler should be in the format `(e:ErrorMessage) => void` where `ErrorMessage` is an object with the shape `{ code: string, message: string, type: "warning" | "error" }`.
|
|
119
142
|
- `overdrawDecorations` - When using text decorations (e.g. `underline`) an additional length in pixels equal to `overdrawDecorations` will be added to _both_ sides of the line. Default is `0`.
|
|
143
|
+
- `lineSpacing` - Sets the default line spacing for all text. Can also be set per-tag in styles. Default is `0`.
|
|
144
|
+
- `paragraphSpacing` - Sets the default paragraph spacing for all text. Can also be set per-tag in styles. Default is `0`.
|
|
120
145
|
|
|
121
146
|
To see a list of the default options, you can view the static property `Glyphs.defaultOptions` or look in the source code for `DEFAULT_OPTIONS`
|
|
122
147
|
|
package/dist/pixi-glyphs.js
CHANGED
|
@@ -1541,9 +1541,18 @@ class Glyphs extends PIXI__namespace.Container {
|
|
|
1541
1541
|
...userStyles
|
|
1542
1542
|
};
|
|
1543
1543
|
}
|
|
1544
|
+
const styleOverrides = {
|
|
1545
|
+
...tagStyles.default
|
|
1546
|
+
};
|
|
1547
|
+
if (options.lineSpacing !== undefined) {
|
|
1548
|
+
styleOverrides.lineSpacing = options.lineSpacing;
|
|
1549
|
+
}
|
|
1550
|
+
if (options.paragraphSpacing !== undefined) {
|
|
1551
|
+
styleOverrides.paragraphSpacing = options.paragraphSpacing;
|
|
1552
|
+
}
|
|
1544
1553
|
const mergedDefaultStyles = {
|
|
1545
1554
|
...DEFAULT_STYLE,
|
|
1546
|
-
...
|
|
1555
|
+
...styleOverrides
|
|
1547
1556
|
};
|
|
1548
1557
|
tagStyles.default = mergedDefaultStyles;
|
|
1549
1558
|
this.tagStyles = tagStyles;
|