From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qK0EGVI1y2K4nQAAbAwnHQ (envelope-from ) for ; Sun, 10 Jul 2022 22:23:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mFYSGFI1y2I1AwEAG6o9tA (envelope-from ) for ; Sun, 10 Jul 2022 22:23:46 +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 EB0F726657 for ; Sun, 10 Jul 2022 22:23:45 +0200 (CEST) Received: from localhost ([::1]:55446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAdSu-0002CC-Ik for larch@yhetil.org; Sun, 10 Jul 2022 16:23:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAdSM-0002C4-Qv for emacs-orgmode@gnu.org; Sun, 10 Jul 2022 16:23:06 -0400 Received: from mout02.posteo.de ([185.67.36.66]:59841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAdSK-0000ND-OY for emacs-orgmode@gnu.org; Sun, 10 Jul 2022 16:23:06 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id D1EFF240108 for ; Sun, 10 Jul 2022 22:23:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1657484582; bh=BHID1+xRQqVPau7kF9VL1AmL7Ms0ydVre/wc/oZ8G7I=; h=From:To:Subject:Date:From; b=QaDeVadqp0EQbtEwRf8/tpFrlxSF92Jr8D58m2RWsxRcBh7K9P9bqQc8YSpYXhZS+ a5FD0D3BNZv+l5SEoiqFpweoFwOWO+crsGaU42ED7Cp1peZLTFTSiNVdT6hACr1gNo t/42GKRfJvJ8bkeNpVwHmJMqlKw9wBa0OmoiF3SwaTRtgMOWnL5i7hC/W+BmywjBh/ wMvxjaJwdVyGBFsm3SI9QOfYghw0TzMW8pD/W63K71QRjk9qdPSvfc9kTsNQnwFYS9 aQAWn+lFB6zBQTFeWojIercVnYwoLcbi/b0xhvF0LT71/cMwYaiBuWW7/0a0Q0KJ17 ekCKpkP6NY7MA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Lgz3V2jxMz9rxL for ; Sun, 10 Jul 2022 22:23:02 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: [possible patch] Basic fontspec code for LuaLaTeX and XelaTeX (was "LaTeX export: when is it more useful...") References: <87ilo7ztm3.fsf@posteo.net> <87ilo7tp78.fsf@tsdye.online> <87o7xy8t4g.fsf@posteo.net> <87a69i8ha1.fsf@posteo.net> <87tu7qnij4.fsf@posteo.net> Date: Sun, 10 Jul 2022 20:23:00 +0000 In-Reply-To: <87tu7qnij4.fsf@posteo.net> ("Juan Manuel =?utf-8?Q?Mac=C3=AD?= =?utf-8?Q?as=22's?= message of "Sat, 09 Jul 2022 20:22:07 +0000") Message-ID: <87r12ssonv.fsf_-_@posteo.net> MIME-Version: 1.0 Content-Type: text/plain 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657484626; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BHID1+xRQqVPau7kF9VL1AmL7Ms0ydVre/wc/oZ8G7I=; b=iy7YLFXlFLJo+4/ye7os8w+x5/snhirolCkA4qB3VA/k2a2ROJuW9w12C4PRUgCwDarpN3 bQRcHCXypkOkUohFob/WOf+nsEPJHPM6F4W40cEHBT7KrCMCVBeAAwOfTvURz94JSTzoqD Oh3D2wZWPAEbfa6VWghe1PHCVeuyOzZrbaghJqZGB0Y4joj0/s4NWpGqsL6MVVyppZaPrc 6WEpRh3mcDePQCsdyJ0wd/BUhp1Tni5oY2FTaUsfOk66w4HReC8LOFK29Mub9Z1zsfKmcd xKcTmbQ49PDqt/3dERkyzbTfkSyELDnPOmxxJ28XTJl9l4NHozVoCPo+Qttjfg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657484626; a=rsa-sha256; cv=none; b=pkfI07xd8sXx6kXXLUhyEMtCn9BdmGh7WuY0VftwHvXWyHQTAEb3XOLon9BAHnRDyg6SZx 6LalLS9a9N1G9YwK+1p1V6kCMPTSnXZCO6Bp96XodsEYlR0nLsksZLlvjMiZW01tfqOfXX 75rsBkElIZ14Fg8WkxW5/z+0CeTlCw/4wUjAMtadl2PkEOJsgF9CBIx7AncxILvytybq6C dVijeUvgvLYC96UPPVTnML6ZrvDVtb62y+K3AFJ8GxpkGoqV/zP4mkuSUPIxZPGPvmuIt1 a1AXplCyJyyF+QGEyV8uU5Jf+VwdN0dl5t1eJLoj0dR6UFdVIAagZO09xH0+Jw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=QaDeVadq; 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" X-Migadu-Spam-Score: -8.95 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=QaDeVadq; 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" X-Migadu-Queue-Id: EB0F726657 X-Spam-Score: -8.95 X-Migadu-Scanner: scn0.migadu.com X-TUID: znfwDCUlgKxy Considering some discussions in the parent thread, I think maybe it wouldn't hurt to ensure a minimal preamble when the output is compiled with LuaLaTeX or XelaTeX, so that some very basic fontspec configuration is loaded to be able to read PDFs in non-Latin scripts. But before proposing the patch directly, I'd like to discuss its structure. I think (IMHO) that a certain balance should be ensured between a) users who don't want to mess with fontspec and want something more out-of-the-box and b) users who prefer to be in control when compiling with LuaTeX and XeTeX. I think maybe it would be nice to let LaTeX do the work, via a conditional from the iftex package (idea taken from pandoc). The structure of the patch could be this: 1. There could be a defcustom, something like 'org-latex-use-fontspec' (I would vote for nil by default). 2. There would be three variables for the default fonts: roman, sans and mono. By default, the FreeSerif, FreeSans and FreeMono fonts could be set as default value, since they are very ubiquitous and have a very good coverage for non-Latin scripts. 3. A variable (something like 'org-latex-fontspec-default-configuration') would return something like this: (format \\usepackage{iftex} \\ifpdftex \\relax \\else \\usepackage{fontspec} \\usepackage{unicode-math} \\defaultfontfeatures{Scale=MatchLowercase} \\defaultfontfeatures[\\rmfamily]{Ligatures=TeX} \\setmainfont{%s} \\setsansfont{%s} \\setmonofont{%s} \\fi org-latex-fontspec-mainfont org-latex-fontspec-sansfont org-latex-fontspec-monofont) (and this string would be added at some point to org-latex-make-preamble) 4. Conclusion: I think the good thing about letting LaTeX do the conditional work with iftex is that it saves us less invasive code on our end. I also think that other more complex approaches, such as searching for the fonts present in the system and adding them according to the document scripts, would lead us to a completely slippery slope. Of course, a list of recommended free-licensed fonts could be included in the documentation. WDYT? Best regards, Juan Manuel