public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Changing font for a particular part of a Word document
@ 2022-01-23  5:56 Nandakumar Chandrasekhar
       [not found] ` <073af144-65b8-488d-abca-08c77d84a764n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nandakumar Chandrasekhar @ 2022-01-23  5:56 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1224 bytes --]

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 for which I would like to 
change the font to font-awesome so that they come up with right icons 
instead of just squares.

Is there 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 these icons as well.

I am able to achiever this in the PDF and HTML by 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 customizations for Font  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 "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 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/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1605 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing font for a particular part of a Word document
       [not found] ` <073af144-65b8-488d-abca-08c77d84a764n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-01-23 16:35   ` BPJ
       [not found]     ` <CADAJKhAguaj8X=zMAxS6M_BEKpTH1SrfMCcpVwf_gUyCfkgQcw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: BPJ @ 2022-01-23 16:35 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]

Custom styles are the answer. Just define 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:

    [👍]{custom-style=Emoji}

[^1]: This 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 typing:

``````lua
function Span (span)
  if span.classes:includes"emoji" then
    span.attributes['custom-style'] = "Emoji"
    return span
  end
  -- else
  return nil
end
``````

Now you can just type `[👍]{.emoji}` and run pandoc with this filter.

It works the same with divs and character styles.


Den sön 23 jan. 2022 06:57Nandakumar Chandrasekhar <navanitachora@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 for which I would like to
> change the font to font-awesome so that they come up with right icons
> instead of just squares.
>
> Is there 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 these icons as well.
>
> I am able to achiever this in the PDF and HTML by 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 customizations for Font  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
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email 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/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 email 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/CADAJKhAguaj8X%3DzMAxS6M_BEKpTH1SrfMCcpVwf_gUyCfkgQcw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4110 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing font for a particular part of a Word document
       [not found]     ` <CADAJKhAguaj8X=zMAxS6M_BEKpTH1SrfMCcpVwf_gUyCfkgQcw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-01-23 16:36       ` BPJ
       [not found]         ` <CADAJKhBVO8w3GwkT2Tm92uF_KL1Je9cQ3tBSHSaZJyb5iDF1vA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: BPJ @ 2022-01-23 16:36 UTC (permalink / raw)
  To: bpj; +Cc: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2992 bytes --]

Den sön 23 jan. 2022 17:35BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> skrev:

> Custom styles are the answer. Just define 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:
>
>     [👍]{custom-style=Emoji}
>
> [^1]: This 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 typing:
>
> ``````lua
> function Span (span)
>   if span.classes:includes"emoji" then
>     span.attributes['custom-style'] = "Emoji"
>     return span
>   end
>   -- else
>   return nil
> end
> ``````
>
> Now you can just type `[👍]{.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ön 23 jan. 2022 06:57Nandakumar Chandrasekhar <
> navanitachora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 for which I would like
>> to change the font to font-awesome so that they come up with right icons
>> instead of just squares.
>>
>> Is there 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 these icons as well.
>>
>> I am able to achiever this in the PDF and HTML by 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 customizations for Font  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
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email 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/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 email 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/CADAJKhBVO8w3GwkT2Tm92uF_KL1Je9cQ3tBSHSaZJyb5iDF1vA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4803 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Changing font for a particular part of a Word document
       [not found]         ` <CADAJKhBVO8w3GwkT2Tm92uF_KL1Je9cQ3tBSHSaZJyb5iDF1vA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-01-24  5:09           ` Nandakumar Chandrasekhar
  0 siblings, 0 replies; 4+ messages in thread
From: Nandakumar Chandrasekhar @ 2022-01-24  5:09 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3819 bytes --]

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 FontAwesomeRegular,
-- FontAwesomeSolid and FontAwesomeBrandds style in the reference docx
function Span (span)
if span.classes:includes"fa-regular" then
span.attributes['custom-style'] = "FontAwesomeRegular"
return span
elseif span.classes:includes"fa-solid" then
span.attributes['custom-style'] = "FontAwesomeSolid"
return span
elseif span.classes:includes"fa-brands" then
span.attributes['custom-style'] = "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ön 23 jan. 2022 17:35BPJ <b...-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> skrev:
>
>> Custom styles are the answer. Just define 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:
>>
>>     [👍]{custom-style=Emoji}
>>     
>> [^1]: This 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 typing:
>>
>> ``````lua
>> function Span (span)
>>   if span.classes:includes"emoji" then
>>     span.attributes['custom-style'] = "Emoji"
>>     return span
>>   end
>>   -- else
>>   return nil
>> end
>> ``````
>>
>> Now you can just type `[👍]{.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ön 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 for which I would like 
>>> to change the font to font-awesome so that they come up with right icons 
>>> instead of just squares.
>>>
>>> Is there 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 these icons as well.
>>>
>>> I am able to achiever this in the PDF and HTML by 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 customizations for Font  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 "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 
>>> <https://groups.google.com/d/msgid/pandoc-discuss/073af144-65b8-488d-abca-08c77d84a764n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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 email 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.

[-- Attachment #1.2: Type: text/html, Size: 6278 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-24  5:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23  5:56 Changing font for a particular part of a Word document Nandakumar Chandrasekhar
     [not found] ` <073af144-65b8-488d-abca-08c77d84a764n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-01-23 16:35   ` BPJ
     [not found]     ` <CADAJKhAguaj8X=zMAxS6M_BEKpTH1SrfMCcpVwf_gUyCfkgQcw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-01-23 16:36       ` BPJ
     [not found]         ` <CADAJKhBVO8w3GwkT2Tm92uF_KL1Je9cQ3tBSHSaZJyb5iDF1vA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-01-24  5:09           ` Nandakumar Chandrasekhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).