From cfa48ceb43709dd1968a4945959b1cbb78fb3346 Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 26 Aug 2026 19:34:47 +0800 Subject: [PATCH 1/4] HH-708: align container fonts with fingerprint maps Co-authored-by: multica-agent --- Dockerfile | 7 +++++++ tests/check.sh | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 18766b3..0e9fd36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,8 +25,15 @@ LABEL org.opencontainers.image.revision="$OCI_REVISION" \ RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ + fonts-dejavu-core \ + fonts-dejavu-extra \ + fonts-freefont-ttf \ fonts-liberation \ + fonts-liberation-sans-narrow \ + fonts-noto-core \ fonts-noto-color-emoji \ + fonts-ubuntu \ + fonts-urw-base35 \ libasound2t64 \ libatk-bridge2.0-0t64 \ libatk1.0-0t64 \ diff --git a/tests/check.sh b/tests/check.sh index d6200a8..f09ef5a 100755 --- a/tests/check.sh +++ b/tests/check.sh @@ -8,6 +8,9 @@ grep -q 'Xvfb :99' docker-entrypoint.sh ! grep -q -- '--headless' docker-entrypoint.sh grep -q -- '--no-sandbox' docker-entrypoint.sh grep -q 'TCP-LISTEN:' docker-entrypoint.sh +for package in fonts-dejavu-core fonts-dejavu-extra fonts-freefont-ttf fonts-liberation fonts-liberation-sans-narrow fonts-noto-core fonts-noto-color-emoji fonts-ubuntu fonts-urw-base35; do + grep -q " $package \\\\" Dockerfile +done grep -q 'git.ipao.vip/rogee/fingerprint-chromium' .gitea/workflows/publish.yml grep -q 'ghcr.io/rogeecn/fingerprint-chromium' .github/workflows/publish.yml grep -q 'packages: write' .gitea/workflows/publish.yml -- 2.54.0 From 308b6c82aa29ff7fad3d68cdda387fc9a5df5345 Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 26 Aug 2026 20:12:14 +0800 Subject: [PATCH 2/4] HH-708: verify runtime font fallbacks Co-authored-by: multica-agent --- Dockerfile | 4 ++++ tests/check.sh | 55 ++++++++++++++++++++++++++++++++++++++++--- tests/font-probe.html | 47 ++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 tests/font-probe.html diff --git a/Dockerfile b/Dockerfile index 0e9fd36..ed0295a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,12 +25,16 @@ LABEL org.opencontainers.image.revision="$OCI_REVISION" \ RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ + fonts-croscore \ + fonts-crosextra-caladea \ + fonts-crosextra-carlito \ fonts-dejavu-core \ fonts-dejavu-extra \ fonts-freefont-ttf \ fonts-liberation \ fonts-liberation-sans-narrow \ fonts-noto-core \ + fonts-noto-cjk \ fonts-noto-color-emoji \ fonts-ubuntu \ fonts-urw-base35 \ diff --git a/tests/check.sh b/tests/check.sh index f09ef5a..9d5603f 100755 --- a/tests/check.sh +++ b/tests/check.sh @@ -8,9 +8,6 @@ grep -q 'Xvfb :99' docker-entrypoint.sh ! grep -q -- '--headless' docker-entrypoint.sh grep -q -- '--no-sandbox' docker-entrypoint.sh grep -q 'TCP-LISTEN:' docker-entrypoint.sh -for package in fonts-dejavu-core fonts-dejavu-extra fonts-freefont-ttf fonts-liberation fonts-liberation-sans-narrow fonts-noto-core fonts-noto-color-emoji fonts-ubuntu fonts-urw-base35; do - grep -q " $package \\\\" Dockerfile -done grep -q 'git.ipao.vip/rogee/fingerprint-chromium' .gitea/workflows/publish.yml grep -q 'ghcr.io/rogeecn/fingerprint-chromium' .github/workflows/publish.yml grep -q 'packages: write' .gitea/workflows/publish.yml @@ -33,3 +30,55 @@ DOCKER_LOG="$docker_log" OCI_REVISION=test PUSH=true PATH="$tmpdir:$PATH" \ ./scripts/build.sh registry.example/fingerprint-chromium > "$tmpdir/output" test "$(cat "$docker_log")" = "manifest inspect registry.example/fingerprint-chromium:1.2.3.4" grep -q 'skipping build and push' "$tmpdir/output" + +font_packages=( + fonts-croscore + fonts-crosextra-caladea + fonts-crosextra-carlito + fonts-dejavu-core + fonts-dejavu-extra + fonts-freefont-ttf + fonts-liberation + fonts-liberation-sans-narrow + fonts-noto-cjk + fonts-noto-color-emoji + fonts-noto-core + fonts-ubuntu + fonts-urw-base35 +) + +version="$(curl --fail --location --retry 3 --silent --show-error \ + https://api.github.com/repos/adryfish/fingerprint-chromium/releases/latest \ + | jq -er '.tag_name | select(test("^[0-9]+(\\.[0-9]+){3}$"))')" +image="fingerprint-chromium-test:$version" +CHROME_VERSION="$version" ./scripts/build.sh fingerprint-chromium-test + +docker run --rm --entrypoint dpkg-query "$image" --show "${font_packages[@]}" >/dev/null + +docker run --rm --entrypoint sh "$image" -c ' + for font do + fc-match --format "%{family}\n" "$font" | grep -Fq "$font" + done +' sh Arimo Tinos Cousine Caladea Carlito \ + 'Noto Sans CJK JP' 'Noto Sans CJK SC' 'Noto Sans CJK TC' \ + 'Noto Serif CJK JP' 'Noto Serif CJK SC' 'Noto Serif CJK TC' + +probe() { + local platform="$1" threshold="$2" output count + output="$(docker run --rm \ + --volume "$PWD/tests/font-probe.html:/tmp/font-probe.html:ro" \ + --entrypoint /opt/chromium/chrome "$image" \ + --no-sandbox --headless=new --disable-gpu --disable-dev-shm-usage \ + --fingerprint=1000 --fingerprint-platform="$platform" \ + --dump-dom "file:///tmp/font-probe.html#$platform" 2>/dev/null)" + count="$(sed -n 's/.*data-count="\([0-9][0-9]*\)".*/\1/p' <<<"$output")" + [[ "$count" =~ ^[0-9]+$ && "$count" -ge "$threshold" ]] || { + printf '%s font probe: expected >= %s, got %s\n' "$platform" "$threshold" "${count:-none}" >&2 + return 1 + } + printf '%s font probe: %s\n' "$platform" "$count" +} + +probe windows 22 +probe macos 24 +probe linux 27 diff --git a/tests/font-probe.html b/tests/font-probe.html new file mode 100644 index 0000000..b8f81ec --- /dev/null +++ b/tests/font-probe.html @@ -0,0 +1,47 @@ + + + -- 2.54.0 From dafe8a396804f11bb6491915bb83fb32237f3c69 Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 26 Aug 2026 20:39:43 +0800 Subject: [PATCH 3/4] HH-708: fail runtime font checks correctly Co-authored-by: multica-agent --- tests/check.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/check.sh b/tests/check.sh index 9d5603f..2b6682e 100755 --- a/tests/check.sh +++ b/tests/check.sh @@ -53,11 +53,15 @@ version="$(curl --fail --location --retry 3 --silent --show-error \ image="fingerprint-chromium-test:$version" CHROME_VERSION="$version" ./scripts/build.sh fingerprint-chromium-test -docker run --rm --entrypoint dpkg-query "$image" --show "${font_packages[@]}" >/dev/null +docker run --rm --entrypoint sh "$image" -c ' + for package do + test "$(dpkg-query -W -f="\${Status}" "$package" 2>/dev/null)" = "install ok installed" || exit 1 + done +' sh "${font_packages[@]}" docker run --rm --entrypoint sh "$image" -c ' for font do - fc-match --format "%{family}\n" "$font" | grep -Fq "$font" + fc-match --format "%{family}\n" "$font" | grep -Fq "$font" || exit 1 done ' sh Arimo Tinos Cousine Caladea Carlito \ 'Noto Sans CJK JP' 'Noto Sans CJK SC' 'Noto Sans CJK TC' \ -- 2.54.0 From 0ce20e75179a6fccfefd0e30289428afb730b01e Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 26 Aug 2026 20:57:56 +0800 Subject: [PATCH 4/4] HH-708: stream font fixture into probe container Co-authored-by: multica-agent --- tests/check.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/check.sh b/tests/check.sh index 2b6682e..c6d413f 100755 --- a/tests/check.sh +++ b/tests/check.sh @@ -69,12 +69,12 @@ docker run --rm --entrypoint sh "$image" -c ' probe() { local platform="$1" threshold="$2" output count - output="$(docker run --rm \ - --volume "$PWD/tests/font-probe.html:/tmp/font-probe.html:ro" \ - --entrypoint /opt/chromium/chrome "$image" \ - --no-sandbox --headless=new --disable-gpu --disable-dev-shm-usage \ - --fingerprint=1000 --fingerprint-platform="$platform" \ - --dump-dom "file:///tmp/font-probe.html#$platform" 2>/dev/null)" + output="$(docker run --rm -i --entrypoint sh "$image" -c ' + cat >/tmp/font-probe.html + exec /opt/chromium/chrome --no-sandbox --headless=new --disable-gpu --disable-dev-shm-usage \ + --fingerprint=1000 --fingerprint-platform="$1" \ + --dump-dom "file:///tmp/font-probe.html#$1" + ' sh "$platform" /dev/null)" count="$(sed -n 's/.*data-count="\([0-9][0-9]*\)".*/\1/p' <<<"$output")" [[ "$count" =~ ^[0-9]+$ && "$count" -ge "$threshold" ]] || { printf '%s font probe: expected >= %s, got %s\n' "$platform" "$threshold" "${count:-none}" >&2 -- 2.54.0