From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 2HULLhR98GQ+MwAAG6o9tA:P1 (envelope-from ) for ; Thu, 31 Aug 2023 13:44:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2HULLhR98GQ+MwAAG6o9tA (envelope-from ) for ; Thu, 31 Aug 2023 13:44:20 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1DB9963B0E for ; Thu, 31 Aug 2023 13:44:20 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=isaOYQ+x; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1693482260; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=DCUHIv/TuDZq9TzCLZHtp9jBghvCK14QDrCMjQYFJ4c=; b=QqMYJwe+qhyL3HOpfK82N33hw9OPsPI4m7XHKB00Y+gG3vm/NG/oGDyPZRRqBD/6P36rlY L0Un23yyjHiuiEOVJb4ukcJJVzujtStjStaRCpT3zfzUmYKwxU+zDuIRZJjWBr29xpqRuK j7loQAUSa6dZj7BpjMWAXGvp27pYFwnVwNmgHJUVDMLZ7Q+qaBKv56nkDo3gUCcSdVQLYD M0ZszFFJU296Dq4u6D5bVf8RP7Sjqw9y5U0WSB4HQHq/5EqyqTUpcZKlFwNeM3ZWfYdzDa rxeLk74s5/zoyOnaHqoTjTpM+TREO0FFCJShI972q6wksqR6DpsCl7XkiPkUoQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=isaOYQ+x; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1693482260; a=rsa-sha256; cv=none; b=cvvX8lCwPI9v34h3YWYTYYl623BwqlwyCCSG9MAtQtxclbKe2ol13ikRecq5RuT669JC6V XiJxnvXx3MhNpSqTaWrXagUsXihMz3zyEpUgLMJ5UncMXrwLkg5/luYqwqvK5Orv2WONXX k8B0aE0NhI025Vl5D/lUtTwPeN842pbRly4aV1q9/3IwDz5Lslc8nJ7s1SzORuopvJzDx0 lW4d0jq9o1zY0jrJNbgcs0OkJER9VCk1gcgMtZwE5owl+6v0C9LXgd6HlZOH6xTmFmAAV2 UxYIz3WaQh8wHbh1RD1T0WnZNyqNLjIoEHBAEVsWKV/nIfVJlv3BX7Bb3XrzxA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbg4s-0008Un-4V; Thu, 31 Aug 2023 07:43:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbg4q-0008UZ-AB for emacs-orgmode@gnu.org; Thu, 31 Aug 2023 07:43:08 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbg4m-0001Ua-Ct for emacs-orgmode@gnu.org; Thu, 31 Aug 2023 07:43:07 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 59235240101 for ; Thu, 31 Aug 2023 13:43:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1693482181; bh=Jv+MhQVPMOKi6pIm+A+T41JyIdcw5SevHj5gtB+qCn4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=isaOYQ+xI0KUjJXHQedDTAUBAueMTnhRPsR2DK8Tg9DUqJVmDGBMFvaCAVHxxOA6i nSH5BMslf1eRkKJIdP9d7Tr+rWMZJwlpm88XXGIMsKakYZFqPMtgXkRGidWezILw/8 zBgAgkrOPE8fNbXGWWE2uPMxwAuu1JUZQAuBXMy3YgFPQgYPw19j2FtdEotk3h7hBb O9FxsuYDpMY9EmYdaA4XxHqYbiD5ObsiQ8cUtlK8niMoqZIJ575dwWdrmnsd6IXsRu 2HrNbzzFV6Kl0NjcsKuV4O5/RVUqNItUfPe+FidSLidwsTHaFr61088MVQRf0ZswSN jpZ6EeHEq/tGg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Rbzn04Kcbz9rxH; Thu, 31 Aug 2023 13:43:00 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Ihor Radchenko Cc: Timothy , orgmode Subject: Re: Fallback fonts in LaTeX export for non latin scripts In-Reply-To: <87wmxbvd60.fsf@localhost> (Ihor Radchenko's message of "Thu, 31 Aug 2023 08:17:27 +0000") References: <878r9t7x7y.fsf@posteo.net> <87wmxbvd60.fsf@localhost> Date: Thu, 31 Aug 2023 11:42:58 +0000 Message-ID: <877cpb8mkd.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -9.93 X-Spam-Score: -9.93 X-Migadu-Queue-Id: 1DB9963B0E X-TUID: HCQ8A7fUQraW Ihor Radchenko writes: > Juan Manuel Mac=C3=ADas writes: >> The idea is to start from a defcustom that is an alist where each element >> has the structure (script font). There would also be a default script + >> font, for example ("latin" "Linux Libertine"). At the moment it would >> only work for the default roman font, but it can be extended to default >> sans serif, mono, etc. > > Are the fonts you have in mind shipped with LuaTeX distribution? Yes, in fact the complete installation of TeX live includes a wide catalog of free opentype fonts with good coverage for non-Latin scripts. Added to that, more free (as in freedom) easily accessible fonts can be recommended. Even many GNU/Linux distros already include them. In any case, the fonts issue is the most delicate part. What default fonts to add to the list? Here the user's taste or preferences would influence. It must also be taken into account that if one has typographical scruples, not all fonts match each other. For design purposes, I mean. The Computer Modern, which is a modern style font (similar to the Didot or Bodoni), does not usually pair well with (for example) a Garamond, which is in the Renaissance style. That's why I think the best solution would be to offer a basic defcustom, based on the purely utilitarian, and let the user modify or extend it according to their taste, preferences or convenience. Another thing to keep in mind is the following. Offering basic readability based on the unicode scripts means that we rely on scripts and not languages. For example, the Cyrillic script covers several languages, as you well know: Russian, Bulgarian, etc. The Latin script is used for languages as diverse as English or Vietnamese. The choice of font based on the script is a low-level LuaTeX functionality, that is, it does not add features specific to each language, such as hyphenation patterns. This means that long texts in (for example) Cyrillic or Greek are not justified well because LaTeX does not know how hyphenate them: https://i.imgur.com/PSja3x2.png However, this may be sufficient for documents containing words or small texts in non latin scripts, rather than long texts. There is another possibility that I am working on in parallel: relying on languages instead of scripts. This would add both readability and support for each particular language. There could be two options for the user: a basic one (the low level one, based on scripts: ensures readability but the document may not look pretty) and an advanced one, based on language support. Something like this occurred to me: #+LaTeX_Header: % !enable-fonts-for ancientgreek russian:Old Standard arabic This means: enable default fonts for ancient Greek and Arabic (associated with Greek and Arabic scripts). For Russian, enable the Old Standard font (included in TeX live). And in the case of Arabic, enable 'bidi' (bidirectional text). If the user added that line it would be enough to do the magic. I hope :-) >> The functionality would not be activated by default. When activated, it >> also enables LuaTeX as the default LaTeX engine, and on each export a >> list of non-latin scripts in the buffer is extracted. Perhaps with >> some code like this, which checks for any non-latin characters: >> >> (let ((scripts)) >> (save-excursion >> (goto-char (point-min)) >> (while >> (re-search-forward "\\([^\u0000-\u007F\u0080-\u00FF\u0100-\u017F= ]\\)" nil t) >> (let ((script (aref char-script-table >> (string-to-char (match-string 1))))) >> (add-to-list 'scripts script) >> (setq script-list scripts)))) >> script-list) >> >> ? >> >> Once the list has been extracted, an ad hoc preamble would be formatted >> assigning each script the chosen font. >> >> WDYT? Do you think this would be a viable path? I think that in a few >> days I can offer something usable for discussion. > > Adding Timothy to CC. His WIP conditional preamble branch looks suitable > to add the proposed functionality. Great! > What will happen if LuaTeX is not installed on the system? Yes, there should be some kind of warning. Also it's not just LuaTeX, but certain packages for fonts and multilingual support. The problem is that the different versions of TeX live cooked in the distros=20 usually name these packages differently. This is another added problem... Arch or Gentoo offer a more vanilla TeX live. > Also, just to double check, is LuaTeX fully compatible to LaTeX? That > is, if we have an existing org file using LaTeX-specific commands and > packages, will it work with LuaTeX? Yes, it is fully compatible, except that LuaLaTeX does not need to load the fontenc or inputenc packages. LuaTeX is intended to be the natural replacement for pdfTeX. The latest edition of The LaTeX Companion is already very focused on LuaTeX. And 90% of the new LaTeX packages that are uploaded to CTAN only work in LuaLaTeX. One of the essential advantages of LuaTeX is that TeX now (finally!) has a simple scripting language. With a little Lua you can achieve very low level things in TeX that were horribly complicated in 'pure TeX'. --=20 Juan Manuel Mac=C3=ADas https://juanmanuelmacias.com https://lunotipia.juanmanuelmacias.com https://gnutas.juanmanuelmacias.com