참고소스 수정본
This commit is contained in:
17
참고/playwright-main/tests/assets/webfont/README.md
Normal file
17
참고/playwright-main/tests/assets/webfont/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
This font contains two glyphs — `+` (U+2B) and `-` (U+2D) — each rendered as a
|
||||
simple filled black rectangle. The simplicity makes screenshot tests insensitive
|
||||
to font-rendering/antialiasing differences across platforms.
|
||||
|
||||
## Regenerating
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```
|
||||
pip3 install fonttools brotli
|
||||
```
|
||||
|
||||
Run `generate_font.py` to regenerate `iconfont.woff2`:
|
||||
|
||||
```
|
||||
python3 tests/assets/webfont/generate_font.py
|
||||
```
|
||||
66
참고/playwright-main/tests/assets/webfont/generate_font.py
Normal file
66
참고/playwright-main/tests/assets/webfont/generate_font.py
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Generate iconfont.woff2 with simple rectangle glyphs for + (U+2B) and - (U+2D).
|
||||
|
||||
Requirements: pip3 install fonttools brotli
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fontTools.fontBuilder import FontBuilder
|
||||
from fontTools.pens.t2CharStringPen import T2CharStringPen
|
||||
|
||||
fb = FontBuilder(1000, isTTF=False)
|
||||
fb.setupGlyphOrder([".notdef", "plus", "hyphen"])
|
||||
fb.setupCharacterMap({0x2B: "plus", 0x2D: "hyphen"})
|
||||
|
||||
fb.setupHorizontalMetrics({
|
||||
".notdef": (1000, 0),
|
||||
"plus": (1000, 100),
|
||||
"hyphen": (1000, 100),
|
||||
})
|
||||
fb.setupHorizontalHeader(ascent=850, descent=-150)
|
||||
fb.setupNameTable({
|
||||
"familyName": "pwtest-iconfont",
|
||||
"styleName": "Regular",
|
||||
})
|
||||
fb.setupOS2(sTypoAscender=850, sTypoDescender=-150, sTypoLineGap=0,
|
||||
usWinAscent=850, usWinDescent=150)
|
||||
fb.setupPost()
|
||||
|
||||
charstrings = {}
|
||||
pen = T2CharStringPen(1000, None)
|
||||
charstrings[".notdef"] = pen.getCharString()
|
||||
|
||||
for name in ["plus", "hyphen"]:
|
||||
pen = T2CharStringPen(1000, None)
|
||||
pen.moveTo((100, 0))
|
||||
pen.lineTo((900, 0))
|
||||
pen.lineTo((900, 700))
|
||||
pen.lineTo((100, 700))
|
||||
pen.closePath()
|
||||
charstrings[name] = pen.getCharString()
|
||||
|
||||
fb.setupCFF(
|
||||
psName="pwtest-iconfont",
|
||||
fontInfo={"version": "1.0"},
|
||||
charStringsDict=charstrings,
|
||||
privateDict={}
|
||||
)
|
||||
|
||||
fb.font.flavor = "woff2"
|
||||
output_path = os.path.join(os.path.dirname(__file__), "iconfont.woff2")
|
||||
fb.font.save(output_path)
|
||||
print(f"Saved {output_path}")
|
||||
14
참고/playwright-main/tests/assets/webfont/iconfont.svg
Normal file
14
참고/playwright-main/tests/assets/webfont/iconfont.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2022 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="fontello" horiz-adv-x="1000" >
|
||||
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
<missing-glyph horiz-adv-x="1000" />
|
||||
<glyph glyph-name="plus" unicode="+" d="M100 0h800v700h-800z" horiz-adv-x="1000" />
|
||||
|
||||
<glyph glyph-name="minus" unicode="-" d="M100 0h800v700h-800z" horiz-adv-x="1000" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 666 B |
BIN
참고/playwright-main/tests/assets/webfont/iconfont.woff2
Normal file
BIN
참고/playwright-main/tests/assets/webfont/iconfont.woff2
Normal file
Binary file not shown.
18
참고/playwright-main/tests/assets/webfont/webfont.html
Normal file
18
참고/playwright-main/tests/assets/webfont/webfont.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'pwtest-iconfont';
|
||||
src: url('./iconfont.woff2') format('woff2');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'pwtest-iconfont';
|
||||
}
|
||||
|
||||
</style>
|
||||
<span>+-</span>
|
||||
|
||||
Reference in New Issue
Block a user