Skip to content

Commit 77d630f

Browse files
committed
fix(playground): add Inter font to VFS and fix Data Binding each template
Add Inter-Regular.ttf to example-assets so it appears in VFS file tree. All examples now explicitly declare the font in assets list. Fix Data Binding example: add as:item to each loop for string arrays.
1 parent 97e4e17 commit 77d630f

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

src/FlexRender.Playground/PlaygroundApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static void Initialize()
3636
_memoryLoader = new MemoryResourceLoader();
3737
_parser = new TemplateParser();
3838

39-
// Load embedded default font (WASM has no system fonts)
39+
// Load embedded default font into VFS (WASM has no system fonts)
4040
LoadEmbeddedFont("Inter-Regular.ttf");
4141

4242
var builder = new FlexRenderBuilder()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:3e5f90a0138b38de4cf4d779ad78391974ea1df776b9164842bdcbb60ce383c5
3+
size 342680

src/FlexRender.Playground/wwwroot/main.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ layout:
5353
size: 28
5454
color: "#333333"
5555
padding: "30"`,
56-
json: '{}'
56+
json: '{}',
57+
assets: ['Inter-Regular.ttf'],
5758
},
5859
'Flex Layout': {
5960
yaml: `canvas:
@@ -88,7 +89,8 @@ layout:
8889
content: "Right (grow: 2)"
8990
color: "#ffffff"
9091
size: 16`,
91-
json: '{}'
92+
json: '{}',
93+
assets: ['Inter-Regular.ttf'],
9294
},
9395
'Data Binding': {
9496
yaml: `canvas:
@@ -116,6 +118,7 @@ layout:
116118
color: "#eee"
117119
- type: each
118120
array: items
121+
as: item
119122
children:
120123
- type: text
121124
content: "\u2022 {{item}}"
@@ -125,14 +128,17 @@ layout:
125128
"title": "Shopping List",
126129
"author": "FlexRender",
127130
"items": ["Apples", "Bread", "Milk", "Cheese"]
128-
}`
131+
}`,
132+
assets: ['Inter-Regular.ttf'],
129133
},
130134
'Image Scaling': {
131135
yaml: `canvas:
132136
fixed: width
133137
width: 440
134138
background: "#ffffff"
135-
139+
fonts:
140+
- name: main
141+
path: Inter-Regular.ttf
136142
layout:
137143
- type: flex
138144
direction: column
@@ -215,14 +221,16 @@ layout:
215221
height: "120"
216222
fit: fill`,
217223
json: '{}',
218-
assets: ['test-pattern.png'],
224+
assets: ['test-pattern.png', 'Inter-Regular.ttf'],
219225
},
220226
'Dynamic Receipt': {
221227
yaml: `canvas:
222228
fixed: width
223229
width: 320
224230
background: "#ffffff"
225-
231+
fonts:
232+
- name: main
233+
path: Inter-Regular.ttf
226234
layout:
227235
- type: flex
228236
padding: "24 20"
@@ -423,7 +431,7 @@ layout:
423431
"paymentUrl": "https://pay.example.com/inv/12345",
424432
"date": "2026-03-10 14:30"
425433
}`,
426-
assets: ['star-badge.png'],
434+
assets: ['star-badge.png', 'Inter-Regular.ttf'],
427435
},
428436
'NDC Receipt': {
429437
yaml: `# NDC (ATM receipt) format — binary terminal data rendered as a receipt

0 commit comments

Comments
 (0)