From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 QARUEmf97mQkHwEA9RJhRA:P1 (envelope-from ) for ; Wed, 30 Aug 2023 10:27:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QARUEmf97mQkHwEA9RJhRA (envelope-from ) for ; Wed, 30 Aug 2023 10:27:19 +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 1A16F5EFB0 for ; Wed, 30 Aug 2023 10:27:14 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PcwrbdB8; 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=1693384034; a=rsa-sha256; cv=none; b=I55jmdTBKJUUpnE3m9FeBrYCNAHdmEDVt0o2yxxYOYThtsWXHAeb0dZ+lfKBRqJFt4lKin geVvU5hvOqOExQ0oHp1ISdiUxQ6Mh3K84/cymfUCAoih/jeqL+QQUJL3hY+EAz95r+sTg/ gOtG9YhJhAOxSJJJrBfhq1+qeRyeZchZTv+zkPNRGPB69aTbXnoFT7rdb2qrgWGgHc5Ock woizO0GwLZex+ZmZFyD8plTVSTZY+fxzm+DzdP3IRwxXa6SzmTf8IjrREdcDnyXx/zegPD JLkTpwKLqx4fa6J6A4YmBfvkiYy7Eqnkp1o4ZD54+bc41mZmJ6WmibZ97S9WGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PcwrbdB8; 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=1693384034; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=TNFuEqd2/5G+nD/i2mJVM5rs9uHsmoD65nSfHT+8suA=; b=biYVpzHVZl3E+3fAqzok+xmZ4HXbJ/18gBp9KZcwPPMIu1wM166A8a7hD4+Gc96ttg097K 3zMyyPGaZmEjAJNARNW5nePv8A+SeC6Yj59fvNF+Ons9RBamzKGbLxZScYHLYnkQEkejX5 Hwxp4PGG8Nj3Bo9gQtlvHV6njWxLP5PC31ERy/w1j1fBv5wqumF/4N8Ua6W54o0w+l2BW7 YQYSes9oynxoLVBpPCvYaO96Ru/9sgmYJqtNOFvUtklN7+bXhOqJzNmgcpsHkzBgCKyrE7 nRXsQR+7YSfncfC5jA+djGH1SXmVyO9NBB5FFXsZ4Y3YNp3IqleiqouUFydnGA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbGWm-00053f-6o; Wed, 30 Aug 2023 04:26:16 -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 1qbGWe-00052s-5t for emacs-orgmode@gnu.org; Wed, 30 Aug 2023 04:26:09 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbGWY-0002yQ-Fn for emacs-orgmode@gnu.org; Wed, 30 Aug 2023 04:26:07 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3A053240028 for ; Wed, 30 Aug 2023 10:25:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1693383957; bh=S9E6y0p2zJ8FsPlYWymHRWn5LHEtBJDynW4g/wRAWAM=; h=From:To:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=PcwrbdB89NqRoEeJpgsDnFBNwVXetgZG8NYZjSDjPC2/UPpnnShubcZH8wiBHV/GL NOt+QEOTy3yUPmLzVAjdZeh45A2GG+8+BaqHf+ZR7k1CujhlKljjkWkmd2t2Vz04Ns UlDdoTHQIByf2DCKBtWiHwHbtkzGMjn3Tlw6XAaoY3RZCq7ByH9hb9V8mpeCoF9Pfm 3uJyviK2cSatPsDxr3NPGExH7XR//y1ior9EJ2uGypUwW5x93wpeJs5ILeyWCyaw0t 3x1cpDTjuQtQHVHhRTok3gsJmKO7wTzYCM5jIcpNA38WM2FuX3mpnie3nH0To623fa 2SqIAl6b1JJXQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RbHS45lQqz6txY for ; Wed, 30 Aug 2023 10:25:56 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Fallback fonts in LaTeX export for non latin scripts Date: Wed, 30 Aug 2023 08:25:53 +0000 Message-ID: <878r9t7x7y.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.65; envelope-from=maciaschain@posteo.net; helo=mout01.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-Queue-Id: 1A16F5EFB0 X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -6.93 X-Spam-Score: -6.93 X-TUID: AyafIcabI5yi The Unicode TeX engines, LuaTeX and XeTeX, have certain features to apply fonts to scripts (Greek, Cyrillic, Arabic, etc.), without the need to switch fonts explicitly. But LaTeX does not include any functionality for loading 'fallback fonts' out of the box. Seeing things from TeX and LaTeX this is understandable: since LaTeX is a typographic tool, the user has the responsibility of choosing the fonts and knowing which fonts to use. But from the Org side things may look different, as the average user (who may not be interested in typographical or font complexities) is looking for immediate readability of their texts when exporting to any format. We know that, when exporting to LaTeX, this does not always happen, if texts include non-Latin scripts. These days I'm working on some experimental code to try to provide Org with some sort of fallbacks fonts on LaTeX export. The functionality would (for now) be linked to LuaTeX + babel package, since XeTeX, although it has the ucharclasses package, is more limited. 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. 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. Best regards, Juan Manuel -- Juan Manuel Mac=C3=ADas