Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp157868pxv; Thu, 24 Jun 2021 05:13:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdpgsMbu/YBs7d0MUeN/qa6Q7c/5J3txrVY3Somt8NJsCgTDWCwbjQcUk86fO1Di1gZpBE X-Received: by 2002:a6b:b4d3:: with SMTP id d202mr1237982iof.26.1624536802751; Thu, 24 Jun 2021 05:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624536802; cv=none; d=google.com; s=arc-20160816; b=Plj2v5SOk56wiQ+bOe5Za+3u4IjqHA4iYrIUcf6JJAkZpTbxFCTfyMOArbGubCzOkF xJ+6ARHkgBopMk342NISrTwHK+NFclC1gTU0m6Lb1xSuC/D6K8mY8yx+qZg9acHamVcc uNCjuMgDlJicsoXXGHj/n53wPqQwQIYqifkqK12S3e06Y0K6v1kEQT1YvHo0ZaHD8n/8 vgSzNR206YxRBmDDKJ/pzgh12AFgJjG1Z6Z5ahpTAuEO4QAy5u6r84cSdMCul2Kw3RGi O3gpE9lCn3pKXdTZVKINuu/xlBAQgMRTa8Kdr04vqO/dGr9Ix0rAg3OoPRcv093QYM2y rlxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=QnuZDfWJ9nUY4Zc0MaK45RKrAmdrTD6w8UxmpGOIRyI=; b=ka+8F4jwHFUvw/7w+OZTa5bNv6vu6w1z6ZEkC0UE1maPbvEOhnCQAxq+vP61eAZREy Ou5PfRAMLExr7Gm9g8UlyezKWbDkXTHKcwv8Cuyon1IyCUEO5fdYFCE6G79VLMsGf5K2 D11uX7UeVZitrNCABzCEaDyfDVBKU/+5RtLsbVLY4YqsEJ+iyGLDleNSDKa/VlpY8KUj ifzXLJiISggRCB91+7jYLAahIpD+XKqnC96RNW0ql4pLMbtjAZBuGZEB1z1wW2guqgiC 3DwrvWxuCTOB5iuOgVxW3xos38JVoK9Dq4vYsO7R2YJeKqVyDhIb641Z9pQ9kOPc75Os KZ+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EAOZRQZ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si2419543ioy.95.2021.06.24.05.13.10; Thu, 24 Jun 2021 05:13:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EAOZRQZ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbhFXMN4 (ORCPT + 99 others); Thu, 24 Jun 2021 08:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231179AbhFXMNv (ORCPT ); Thu, 24 Jun 2021 08:13:51 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33196C061766; Thu, 24 Jun 2021 05:11:32 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id v12so2839893plo.10; Thu, 24 Jun 2021 05:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QnuZDfWJ9nUY4Zc0MaK45RKrAmdrTD6w8UxmpGOIRyI=; b=EAOZRQZ2OMS1GLn6X7klPVdCX3ep/RZioVkQJfbwT1VIIDNUQKthjOCFfDAU7Q5ztj CwgjbQLnpYw/Htbs0lq1cj96lxFVF+zCMiSEDp28/HUx6FUUilRchmj1ZIxeUcB4sbWy w0fvKZK2rKHXm9pcpuiQp017W20WiOvY9xcWgsEQ/299BZFNRDeLEhtLkZXHhXxsUDy0 ha+reLbOVeeLS5R+d9ORQpPoV7PB7C6a1sFy+TGbfylahZkuXQESDYufj3IXwNLe7SW7 ZFBUt04bwk5i13sK/gKO3w89EBWOwBZ+f18OS1IZDFkd32oeK5tYjsMoESaF6ErqVXwx WZxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QnuZDfWJ9nUY4Zc0MaK45RKrAmdrTD6w8UxmpGOIRyI=; b=McKpL6PuG0Oe9vZFAF4c2m7w8jzPLyF6+TUZgA/di6/hUYM+RAHoHrzBhSOecxGh+z AMs2ev97+dcNXmNxX1vCSWYBO4YAx7BIIz3ac8fhWuudb4EpbsQ7oFVMaNa9jdqRNMbI 4+8qZjgquccjunO5Gn/vU7iBFNfongolTVQgfB7QPkePO66aPjsxFVmTQcqBxd+ky5Ih cNpFlDJmDh/Blr8CWfIPnNV0rGGhHQX5ht403fwxOG2NejCKDxaaXC6pFVi/etLNyRzT hRq7U3dDM9ZbfbMbJBA01u9tIlqEVs1/DQjf1j5m02fQzf+rMA7d3a4OiCqpM3grXJtB H5PQ== X-Gm-Message-State: AOAM532WQU4i4pFIzmBJ8W1SLIgXCkya7li/3VdD9f+cqnMi1RmYiLt4 Wqy/MpZhNjDen5zGo0P5ZKI= X-Received: by 2002:a17:90a:6394:: with SMTP id f20mr14841367pjj.80.1624536691830; Thu, 24 Jun 2021 05:11:31 -0700 (PDT) Received: from [192.168.11.2] (KD106167171201.ppp-bb.dion.ne.jp. [106.167.171.201]) by smtp.gmail.com with ESMTPSA id w2sm2513240pjq.5.2021.06.24.05.11.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 05:11:31 -0700 (PDT) Subject: [RFC PATCH 2/3] docs: pdfdocs: Add font settings for CJK ascii-art To: Jonathan Corbet , Mauro Carvalho Chehab Cc: "Wu X.C." , SeongJae Park , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Akira Yokosawa References: <386938dc-6290-239c-4b4f-c6153f3d98c5@gmail.com> From: Akira Yokosawa Message-ID: Date: Thu, 24 Jun 2021 21:11:28 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <386938dc-6290-239c-4b4f-c6153f3d98c5@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is irrelevant to those who don't care translations docs. Current font choice of "DejaVu Sans Mono" and "Noto Sans CJK SC" for monospace fonts generates misaligned ascii-art figures in translations. Using "Noto Sans Mono CJK SC" for both the monofont and CJKmonofont choices is a better option. As for Korean translation, there remain character width mismatches. Hangul characters in "Noto Sans Mono CJK SC" are slightly narrower than Chinese and Japanese characters, despite the "Mono" in the font name. This results in mis-aligned ascii-art figures in Korean translation of memory-barriers.txt. Proper width Hangul characters are available in "Unifont", although with degraded look of CJK characters due to Unifont's bitmap-font nature. So "Unifont" is used only when it is found on the system. Note 1: Unifont can be installed by: (Ubuntu) apt-get install ttf-unifont (Fedora) dnf install unifont-fonts Note 2: Let us know if there is a better monospace font choice for Hangul. Note 3: Sphinx itself is confused by tabs behind CJK characters. Korean translation of memory-barriers.txt needs a couple of fixes to this effect, of which a follow up change takes care. Signed-off-by: Akira Yokosawa --- Documentation/conf.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/conf.py b/Documentation/conf.py index 22f083bafaae..a95bd2123da1 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -363,12 +363,19 @@ latex_elements['preamble'] += ''' % This is needed for translations \\usepackage{xeCJK} \\setCJKmainfont{Noto Sans CJK SC} + \\setCJKsansfont{Noto Sans CJK SC} + \\setCJKmonofont{Noto Sans Mono CJK SC} + \\setmonofont{Noto Sans Mono CJK SC} % Define custom macros to on/off CJK \\newcommand{\\kerneldocCJKon}{\\makexeCJKactive} \\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive} % Inactivate CJK after tableofcontents (using etoolbox) \\usepackage{etoolbox} \\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{} + \\IfFontExistsTF{Unifont}{ + % For alinged Korean ascii-art + \\setCJKmonofont{Unifont} + }{} }{ % No CJK font % Custom macros to on/off CJK (Dummy) \\newcommand{\\kerneldocCJKon}{} -- 2.17.1