Skip to content

Commit 4ef9c78

Browse files
jasonleenaylorclaude
authored andcommitted
Download Charis SIL test font instead of committing it
The Views shaping tests bundled CharisSIL 5.000 in the repo. Instead, download Charis SIL 6.200 from a pinned GitHub release at build time into the git-ignored Downloads/ and copy it beside TestViews.exe; remove the committed font. The OpenType metrics test moves from liga to smcp: in Charis 6.x the fi/ffi ligatures keep the component advance widths, so liga changes the rendered glyphs (still covered by the pixel tests) without changing segment metrics, whereas small caps do change advance width. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7b1269e commit 4ef9c78

7 files changed

Lines changed: 39 additions & 202 deletions

File tree

Build/PackageRestore.targets

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<!-- Scheherazade New: deterministic Arabic font for the render-snapshot tests; download from
3636
GitHub release (https://github.com/silnrsi/font-scheherazade/releases). -->
3737
<ScheherazadeNewVersion>4.500</ScheherazadeNewVersion>
38+
<!-- Charis SIL: test font for the Views Uniscribe/Graphite shaping tests; download from
39+
GitHub release (https://github.com/silnrsi/font-charis/releases). v6.x keeps the
40+
"Charis SIL" family name (v7 renames it to "Charis"). -->
41+
<CharisSilVersion>6.200</CharisSilVersion>
3842
<!-- PackagesDir: Use local packages folder. -->
3943
<PackagesDir>$(fwrt)/packages</PackagesDir>
4044
</PropertyGroup>
@@ -291,6 +295,20 @@
291295
DownloadsDir="$(DownloadsDir)"
292296
Condition="'$(OS)'=='Windows_NT' AND !Exists('$(DownloadsDir)/TonePars64.exe')"
293297
/>
298+
<!-- Charis SIL font: test font for the Views shaping tests (TestViews). Downloaded once into
299+
Downloads/ and unzipped there; TestViews.vcxproj copies the regular face into its output.
300+
Pinned to a release rather than committed to the repo. -->
301+
<DownloadFile
302+
Address="https://github.com/silnrsi/font-charis/releases/download/v$(CharisSilVersion)/CharisSIL-$(CharisSilVersion).zip"
303+
LocalFilename="CharisSIL-$(CharisSilVersion).zip"
304+
DownloadsDir="$(DownloadsDir)"
305+
Condition="'$(OS)'=='Windows_NT' AND !Exists('$(DownloadsDir)/CharisSIL-$(CharisSilVersion).zip')"
306+
/>
307+
<Unzip
308+
ZipFilename="$(DownloadsDir)/CharisSIL-$(CharisSilVersion).zip"
309+
ToDir="$(DownloadsDir)/CharisSIL"
310+
Condition="'$(OS)'=='Windows_NT' AND Exists('$(DownloadsDir)/CharisSIL-$(CharisSilVersion).zip') AND !Exists('$(DownloadsDir)/CharisSIL/CharisSIL-$(CharisSilVersion)/CharisSIL-Regular.ttf')"
311+
/>
294312
<!-- Scheherazade New font: deterministic Arabic glyph source for the render-snapshot tests
295313
(RootSiteTests). Downloaded once into Downloads/ and unzipped there; RootSiteTests copies
296314
the regular face into its test output. Pinned to a release so all machines/CI render
-1.44 MB
Binary file not shown.

Src/views/Test/TestData/Fonts/CharisSIL-5.000/OFL.txt

Lines changed: 0 additions & 94 deletions
This file was deleted.

Src/views/Test/TestData/Fonts/CharisSIL-5.000/README.txt

Lines changed: 0 additions & 81 deletions
This file was deleted.

Src/views/Test/TestUniscribeEngine.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ namespace TestViews
201201
pchLastSlash != NULL);
202202
*(pchLastSlash + 1) = 0;
203203
wcscat_s(rgchPath, _countof(rgchPath),
204-
L"TestData\\Fonts\\CharisSIL-5.000\\CharisSIL-R.ttf");
204+
L"TestData\\Fonts\\CharisSIL\\CharisSIL-Regular.ttf");
205205

206206
DWORD dwAttributes = ::GetFileAttributesW(rgchPath);
207207
unitpp::assert_true("Charis SIL test font should be copied beside TestViews.exe",
@@ -324,15 +324,19 @@ namespace TestViews
324324
unitpp::assert_true("Charis SIL test font should load", font.Loaded());
325325
SetDefaultFontForTest(L"Charis SIL");
326326

327-
int dxWithoutLigatures = MeasureTextWithFeatures(L"office official affinity", L"liga=0");
328-
int dxWithLigatures = MeasureTextWithFeatures(L"office official affinity", L"liga=1");
327+
// Small caps replace lowercase letters with glyphs of different advance widths, so the
328+
// measured segment width changes. (The liga feature was previously used here, but in
329+
// Charis SIL 6.x the fi/ffi ligatures keep the component advance widths, so liga changes
330+
// the rendered glyphs without changing segment metrics.)
331+
int dxWithoutSmallCaps = MeasureTextWithFeatures(L"small caps verify", L"smcp=0");
332+
int dxWithSmallCaps = MeasureTextWithFeatures(L"small caps verify", L"smcp=1");
329333

330334
unitpp::assert_true("OpenType feature-off segment width should be positive",
331-
dxWithoutLigatures > 0);
335+
dxWithoutSmallCaps > 0);
332336
unitpp::assert_true("OpenType feature-on segment width should be positive",
333-
dxWithLigatures > 0);
334-
unitpp::assert_true("Charis SIL liga feature should change segment metrics",
335-
dxWithoutLigatures != dxWithLigatures);
337+
dxWithSmallCaps > 0);
338+
unitpp::assert_true("Charis SIL smcp feature should change segment metrics",
339+
dxWithoutSmallCaps != dxWithSmallCaps);
336340
#endif
337341
}
338342

Src/views/Test/TestViews.vcxproj

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,6 @@
423423
<ItemGroup>
424424
<None Include="testViews.mak" />
425425
<None Include="NiceGuy.bmp" />
426-
<None Include="TestData\Fonts\CharisSIL-5.000\CharisSIL-R.ttf" />
427-
<None Include="TestData\Fonts\CharisSIL-5.000\OFL.txt" />
428-
<None Include="TestData\Fonts\CharisSIL-5.000\README.txt" />
429426
</ItemGroup>
430427

431428
<!-- Resource file -->
@@ -442,16 +439,18 @@
442439
WorkingDirectory="$(ProjectDir)" />
443440
</Target>
444441

445-
<ItemGroup>
446-
<CharisSilTestFont Include="$(ProjectDir)TestData\Fonts\CharisSIL-5.000\CharisSIL-R.ttf" />
447-
<CharisSilTestFont Include="$(ProjectDir)TestData\Fonts\CharisSIL-5.000\OFL.txt" />
448-
<CharisSilTestFont Include="$(ProjectDir)TestData\Fonts\CharisSIL-5.000\README.txt" />
449-
</ItemGroup>
450-
442+
<!-- Charis SIL test font: downloaded (not committed) by Build/PackageRestore.targets into
443+
Downloads/CharisSIL; copied beside TestViews.exe so the shaping tests can load it privately.
444+
The ItemGroup is inside the target so the glob resolves at execution time (after the download
445+
in the downloadDlls step), and the recursive glob avoids hard-coding the pinned version. -->
451446
<Target Name="CopyCharisSilTestFont" AfterTargets="Build">
447+
<ItemGroup>
448+
<CharisSilTestFont Include="$(FwRoot)\Downloads\CharisSIL\**\CharisSIL-Regular.ttf" />
449+
</ItemGroup>
452450
<Copy SourceFiles="@(CharisSilTestFont)"
453-
DestinationFolder="$(OutDir)TestData\Fonts\CharisSIL-5.000"
454-
SkipUnchangedFiles="true" />
451+
DestinationFolder="$(OutDir)TestData\Fonts\CharisSIL"
452+
SkipUnchangedFiles="true"
453+
Condition="'@(CharisSilTestFont)' != ''" />
455454
</Target>
456455

457456
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

Src/views/Test/TestViews.vcxproj.filters

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,6 @@
139139
<None Include="NiceGuy.bmp">
140140
<Filter>Resource Files</Filter>
141141
</None>
142-
<None Include="TestData\Fonts\CharisSIL-5.000\CharisSIL-R.ttf">
143-
<Filter>Resource Files</Filter>
144-
</None>
145-
<None Include="TestData\Fonts\CharisSIL-5.000\OFL.txt">
146-
<Filter>Resource Files</Filter>
147-
</None>
148-
<None Include="TestData\Fonts\CharisSIL-5.000\README.txt">
149-
<Filter>Resource Files</Filter>
150-
</None>
151142
<None Include="testViews.mak" />
152143
<None Include="Makefile" />
153144
</ItemGroup>

0 commit comments

Comments
 (0)