From ed332966d94ad5f0024735150408105bc056dded Mon Sep 17 00:00:00 2001 From: mmjang <752515918@qq.com> Date: Wed, 12 Jul 2023 18:44:25 +0800 Subject: [PATCH] make weekday font smaller for Chinese locale (#2535) (#2571) * make weekday font smaller for Chinese locale (#2535) * add item to contributor list --- CONTRIBUTORS | 1 + ts/graphs/calendar.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 26d4e4ba8..bacefc3cb 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -126,6 +126,7 @@ Joel Koen Christopher Woggon Kavel Rao Ben Yip +mmjang <752515918@qq.com> ******************** diff --git a/ts/graphs/calendar.ts b/ts/graphs/calendar.ts index 30d98819d..29aa88a41 100644 --- a/ts/graphs/calendar.ts +++ b/ts/graphs/calendar.ts @@ -21,6 +21,7 @@ import { timeYear, } from "d3"; +import { firstLanguage } from "../lib/i18n/bundles"; import type { GraphBounds, SearchDispatch } from "./graph-helpers"; import { RevlogRange, setDataAvailable } from "./graph-helpers"; import { clickableClass } from "./graph-styles"; @@ -154,6 +155,8 @@ export function renderCalendar( const height = bounds.height / 10; const emptyColour = nightMode ? "#333" : "#ddd"; + const firstLang = firstLanguage(); + svg.select("g.weekdays") .selectAll("text") .data(sourceData.weekdayLabels) @@ -166,7 +169,7 @@ export function renderCalendar( .attr("fill", nightMode ? "#ddd" : "black") .attr("dominant-baseline", "hanging") .attr("text-anchor", "end") - .attr("font-size", "small") + .attr("font-size", firstLang.includes("zh") ? "xx-small" : "small") .attr("font-family", "monospace") .attr("direction", "ltr") .style("user-select", "none")