From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30036 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nandakumar Chandrasekhar Newsgroups: gmane.text.pandoc Subject: Re: Changing font for a particular part of a Word document Date: Sun, 23 Jan 2022 21:09:42 -0800 (PST) Message-ID: <5daa7a95-afa9-49e2-ac03-d56bb448f3b3n@googlegroups.com> References: <073af144-65b8-488d-abca-08c77d84a764n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1182_2086201689.1643000982259" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18135"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCY7JSF32YFRBF7JXCHQMGQE7ZVELMQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Jan 24 06:09:46 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f189.google.com ([209.85.167.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nBrbu-0004Yl-7U for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 24 Jan 2022 06:09:46 +0100 Original-Received: by mail-oi1-f189.google.com with SMTP id bi18-20020a056808189200b002cda020b174sf351242oib.20 for ; Sun, 23 Jan 2022 21:09:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=lr2nVTQY2j8mziwYeUoxwQllZYe/FUiL9sqkKls44u8=; b=eiQ/AL5orEU23J/6/AAfQBrkZnUaVZ6FSvevjUFHQEi9gyGZt0aQFSUxx4bb3NXc4w Xt2g7UmXeFPdFZcb33v3hRukZ2V0g6YXTLcb51UKcu1zBnmzIVsBNY60Vreq+Bco6r9x WFQr2JjkIHsJZN9Or6gPVjAZ2qE4JHIiRQFRQhrmVIlg4j26zUcY60gYnhT+1GmgRm2A 9/fzmw/SNYmNwA5wzQ8dBL1zZiZ2+LVgJ7Jl6nyIIhEgaT+/ytf+VyR0GEndAqZh76jZ 7VkyaojFo7aCoeRGIqprsOii0wYxSKtKXI+3X8u5KX0ubYpAaWS6sFp6O5SamFF7Mwk8 vaTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=lr2nVTQY2j8mziwYeUoxwQllZYe/FUiL9sqkKls44u8=; b=X/4nIDT8QCtiSv0qqrF6tKjMNqDe3wKWhxkmzONL7kHgr8D3EeqF26sSGomDJhF76t r7t/QFaSVNw6AKulqswWk1NgTVQiRf7rdbnpGvXKo2I7uk4D/OtedTL77H8xJYykqGEy ntgE1kUSr6UJbfGuCUtGoQKtz3LGEkLYzSjiHL1ih0jgLa0MRoXzsmLNhQMxJNYEBmJM 6aCJJbUXNePS7gXKA8MxymF14Dl8wqxCYFrvruoVjD96fAjp6nwGaL7685aAM1LQuE8p zBlPGZ4E3n6Ak29bKfhWOmGzM1TBTPH+bwHMaH+3K8bduAi9+yrqGeDOz0zgL9NJMtQQ ewaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=lr2nVTQY2j8mziwYeUoxwQllZYe/FUiL9sqkKls44u8=; b=IsHNFX6SNra98RMXfUqm+v3hFtQo8j2inawC0/1AlNoqFznDPS/J7Vgca2KzYnybjt +WYIrvB+kl+eltcHYvsn9u/kaF4L0tgj4M5RHAp6OFioL6Hz7UGqR+YYb240GVy7Q7Ix OOXOX+S/aVusmwweVsQ8T04nu2vILSyegbcjKljX9GkrHFchx9FmPf5TcCQ05X7C3V5V Qoq9o+66N1UOhGjqzlsK+597ZVMA9GW0MfHVxTTr4fJ9Oq5NzzPu8L+xgmp/j5eZAome cvg2Xq92w4kovpano+VVEqzsIZS/ZfFUTusoTofZc7IYK1E+58TBG6lR+Te9g6ddzyEG Cjhw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531kSY/Ljk4iI5HhP+51iGb7O/qCPT6PHUdc6fEtADpPC06vYCNa /zLArK9U7fQzRlB8AYfRFSY= X-Google-Smtp-Source: ABdhPJxNC/Ll7DcB9mXJ70ryqWPpfLe3rRGoONA4RLeo/xqYlrQiWCrSUbbVoNUjM5YAJ6TtWOZpFQ== X-Received: by 2002:a05:6808:221d:: with SMTP id bd29mr223364oib.56.1643000985154; Sun, 23 Jan 2022 21:09:45 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:17a2:: with SMTP id bg34ls4944862oib.6.gmail; Sun, 23 Jan 2022 21:09:43 -0800 (PST) X-Received: by 2002:a54:4497:: with SMTP id v23mr211875oiv.148.1643000982881; Sun, 23 Jan 2022 21:09:42 -0800 (PST) In-Reply-To: X-Original-Sender: navanitachora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30036 Archived-At: ------=_Part_1182_2086201689.1643000982259 Content-Type: multipart/alternative; boundary="----=_Part_1183_1126197011.1643000982259" ------=_Part_1183_1126197011.1643000982259 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks @BPJ once I had setup the font awesome styles in the reference docx= =20 I used the following lua code: ```lua -- Before using this filter please set up the FontAwesomeRegular, -- FontAwesomeSolid and FontAwesomeBrandds style in the reference docx function Span (span) if span.classes:includes"fa-regular" then span.attributes['custom-style'] =3D "FontAwesomeRegular" return span elseif span.classes:includes"fa-solid" then span.attributes['custom-style'] =3D "FontAwesomeSolid" return span elseif span.classes:includes"fa-brands" then span.attributes['custom-style'] =3D "FontAwesomeBrands" return span -- else end return nil end ``` Just posting it here incase some else finds this useful. On Sunday, January 23, 2022 at 10:06:59 PM UTC+5:30 BPJ wrote: > > > Den s=C3=B6n 23 jan. 2022 17:35BPJ skrev: > >> Custom styles are the answer. Just define a named character style=20 >> "Awesome", or perhaps "Emoji" in case you change fonts with the right fo= nt=20 >> in the right size[^1] in your reference-doc, and then in your markdown= =20 >> source: >> >> [=F0=9F=91=8D]{custom-style=3DEmoji} >> =20 >> [^1]: This is assuming that your "word processor" can handle color fonts= .=20 >> If not Symbola is a good b/w alternative. >> >> If you do this a lot a Lua filter can save you some typing: >> >> ``````lua >> function Span (span) >> if span.classes:includes"emoji" then >> span.attributes['custom-style'] =3D "Emoji" >> return span >> end >> -- else >> return nil >> end >> `````` >> >> Now you can just type `[=F0=9F=91=8D]{.emoji}` and run pandoc with this = filter. >> >> It works the same with divs and character styles. >> > > Sorry! Divs and *paragraph* styles of course! > > >> >> Den s=C3=B6n 23 jan. 2022 06:57Nandakumar Chandrasekhar =20 >> skrev: >> >>> Dear Folks, >>> >>> Is there a way to change the font for a particular part of a DOCX word= =20 >>> document? >>> >>> I am using Source Sans Pro as the main font for my document but I am=20 >>> using font awesome icons in some parts of the text for which I would li= ke=20 >>> to change the font to font-awesome so that they come up with right icon= s=20 >>> instead of just squares. >>> >>> Is there a way to do this with a lua filter so that I do not have to go= =20 >>> into the and do some post processing? I will also like to change the fo= nt=20 >>> color of these icons as well. >>> >>> I am able to achiever this in the PDF and HTML by writing some raw late= x=20 >>> and HTML respectively but I am not sure how to do this for DOCX. >>> >>> I am using a reference DOCX with some minor customizations for Font an= d=20 >>> font size. >>> >>> I hope someone can lend me some insight. >>> >>> Thanks in advance, >>> Nanda >>> >>> --=20 >>> You received this message because you are subscribed to the Google=20 >>> Groups "pandoc-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send= =20 >>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit=20 >>> https://groups.google.com/d/msgid/pandoc-discuss/073af144-65b8-488d-abc= a-08c77d84a764n%40googlegroups.com=20 >>> >>> . >>> >> --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/5daa7a95-afa9-49e2-ac03-d56bb448f3b3n%40googlegroups.com. ------=_Part_1183_1126197011.1643000982259 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks @BPJ once I had setup the font awesome styles in the reference docx = I used the following lua code:

```lua
-- Before using this filter please set up the FontAwesomeR= egular,
-- FontAwesomeSolid and FontAwesomeBrandds style in the r= eference docx
function Span (span)
if span.classes:= includes"fa-regular" then
span.attributes['custom-style']= =3D "FontAwesomeRegular"
return span
elsei= f span.classes:includes"fa-solid" then
span.attributes['c= ustom-style'] =3D "FontAwesomeSolid"
return span
elseif span.classes:includes"fa-brands" then
span.a= ttributes['custom-style'] =3D "FontAwesomeBrands"
return = span
-- else
end
return nil
=
end
``` Just posting it here incase some else finds this useful.
<= br>
= On Sunday, January 23, 2022 at 10:06:59 PM UTC+5:30 BPJ wrote:

Den = s=C3=B6n 23 jan. 2022 17:35BPJ <b...-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> skrev:
<= div dir=3D"auto">
Custom styles are the answer. Just defin= e a named character style "Awesome", or perhaps "Emoji"= in case you change fonts with the right font in the right size[^1] in your= reference-doc, and then in your markdown source:
=C2=A0 =C2=A0 [=F0=9F=91=8D]{custom-style=3DEmoji= }
=C2=A0 =C2=A0=C2=A0
[^1]: T= his is assuming that your "word processor" can handle color fonts= . If not Symbola is a good b/w alternative.

If you do this a lot a Lua filter can save you some typ= ing:

``````lua
function Span (span)
=C2=A0 if span.cl= asses:includes"emoji" then
=C2=A0 =C2=A0 s= pan.attributes['custom-style'] =3D "Emoji"
=C2=A0 =C2=A0 return span
=C2=A0 end
=
=C2=A0 -- else
=C2=A0 return nil
end
``````

Now you can just type `[=F0=9F=91=8D]{.emoj= i}` and run pandoc with this filter.

It works the same with divs and character styles.
<= /blockquote>

Sorry! Divs and *paragraph* styles of course!



Den s=C3=B6n 23 jan. 2022 06:57Nandakumar Chandrasekhar= <navani...@gmail.= com> skrev:
Dear Folks,
=
Is there a way to change the font for a particular part of a= DOCX word document?

I am using Source Sans Pro as the main font for= my document but I am using font awesome icons in some parts of the text fo= r which I would like to change the font to font-awesome so that they come u= p with right icons instead of just squares.

Is the= re a way to do this with a lua filter so that I do not have to go into the = and do some post processing? I will also like to change the font color of t= hese icons as well.

I am able to achiever this in the PDF and HTML b= y writing some raw latex and HTML respectively but I am not sure how to do = this for DOCX.

I am using a reference DOCX with some minor customiza= tions for Font=C2=A0 and font size.

I hope someone can lend me some = insight.

Thanks in advance,
Nanda

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pa= ndoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid= /pandoc-discuss/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to
pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/5daa7a95-afa9-49e2-ac03-d56bb448f3b3n%40googlegroups.= com.
------=_Part_1183_1126197011.1643000982259-- ------=_Part_1182_2086201689.1643000982259--