emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-odt: specifying fonts
@ 2011-10-18 16:32 Mehul Sanghvi
  2011-10-18 20:04 ` Christian Moe
  0 siblings, 1 reply; 12+ messages in thread
From: Mehul Sanghvi @ 2011-10-18 16:32 UTC (permalink / raw)
  To: emacs-orgmode

This may not be specific to org-odt, but maybe applies to Org itself.

I have a LaTeX file which I use for my resume at the moment.  The
fonts that are being used with it are great for what I want.
How do I specify fonts that I want to use, rather then the defaults?
Do I have to do that through styles.odt ?
If so, is there a specific OPTION for specifying the style file to use
?   That would be a nice enhancement if it is not already there.

I may want to use different styles/fonts, etc. and probably do not
want to play around with the styles.odt file each time I make
changes to the styles.odt file.




-- 
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com

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

* Re: org-odt: specifying fonts
  2011-10-18 16:32 org-odt: specifying fonts Mehul Sanghvi
@ 2011-10-18 20:04 ` Christian Moe
  2011-10-18 21:15   ` Mehul Sanghvi
  2011-10-19 17:54   ` Jambunathan K
  0 siblings, 2 replies; 12+ messages in thread
From: Christian Moe @ 2011-10-18 20:04 UTC (permalink / raw)
  To: Mehul Sanghvi; +Cc: emacs-orgmode, Jambunathan K

Hi, Mehul, cc: Jambunathan,

I agree with Mehul it would be great to have an option to specify a 
styles file on a per-file basis. Something like:

   #+ODT_STYLE: ~/org/odt-templates/cv.odt

Jambunathan, please consider this a feature request (if you haven't 
implemented it already, and I've missed it as usual...)

Many users will want to use different styles files for different kinds 
of document (e.g. report.odt, cv.odt). Customizing 
org-export-odt-styles-file every time they've got a different kind of 
document to export does not seem the best way. There should be a way 
for each Org file to remember what ODT style it wants, parallel to the 
options that exist for html (#+STYLE) and latex (#+LATEX_HEADER).

As for specifying fonts, etc., in ODT export, that's definitely 
something that should be done through the choice of an external style 
template. The org-odt exporter has done its job if everything you 
could reasonably want to style is exported in a named paragraph or 
character style that you can apply a template to.

Yours,
Christian

PS. Mehul, I do have a stopgap solution for specifying the style 
template on a per-file basis. Place this somewhere in your Org 
document (e.g. before the first heading), and replace 
"/path/to/template.odt" with the path to your styles file.

#+begin_src emacs-lisp :results silent :exports results
(setq org-export-odt-styles-file "/path/to/template.odt")
#+end_src


On 10/18/11 6:32 PM, Mehul Sanghvi wrote:
> This may not be specific to org-odt, but maybe applies to Org itself.
>
> I have a LaTeX file which I use for my resume at the moment.  The
> fonts that are being used with it are great for what I want.
> How do I specify fonts that I want to use, rather then the defaults?
> Do I have to do that through styles.odt ?
> If so, is there a specific OPTION for specifying the style file to use
> ?   That would be a nice enhancement if it is not already there.
>
> I may want to use different styles/fonts, etc. and probably do not
> want to play around with the styles.odt file each time I make
> changes to the styles.odt file.
>
>
>
>

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

* Re: org-odt: specifying fonts
  2011-10-18 20:04 ` Christian Moe
@ 2011-10-18 21:15   ` Mehul Sanghvi
  2011-10-19 14:35     ` Matt Price
  2011-10-19 19:37     ` Christian Moe
  2011-10-19 17:54   ` Jambunathan K
  1 sibling, 2 replies; 12+ messages in thread
From: Mehul Sanghvi @ 2011-10-18 21:15 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Jambunathan K

Christian,

      Thanks for the stopgap measure.  As for fonts, like styles, it
would be easier, simpler and more elegant
to be able to do that without having to edit styles.odt every time.
This is not specific to org-odt.  It should be,
at least I think so for now, to do this with any exporting backend.

If you send me a styles.odt, and I do not like the fonts you are
using, it becomes cumbersome to be editing the styles.odt
for each font and making sure to change it in all possible places
until I settle on a proper font I want to use.

If I could instead specify the font in org file itself, it would be a
matter of changing the header and re-generating the file.

The ODT_STYLE is certainly a good enhancement.




On Tue, Oct 18, 2011 at 16:04, Christian Moe <mail@christianmoe.com> wrote:
> Hi, Mehul, cc: Jambunathan,
>
> I agree with Mehul it would be great to have an option to specify a styles
> file on a per-file basis. Something like:
>
>  #+ODT_STYLE: ~/org/odt-templates/cv.odt
>
> Jambunathan, please consider this a feature request (if you haven't
> implemented it already, and I've missed it as usual...)
>
> Many users will want to use different styles files for different kinds of
> document (e.g. report.odt, cv.odt). Customizing org-export-odt-styles-file
> every time they've got a different kind of document to export does not seem
> the best way. There should be a way for each Org file to remember what ODT
> style it wants, parallel to the options that exist for html (#+STYLE) and
> latex (#+LATEX_HEADER).
>
> As for specifying fonts, etc., in ODT export, that's definitely something
> that should be done through the choice of an external style template. The
> org-odt exporter has done its job if everything you could reasonably want to
> style is exported in a named paragraph or character style that you can apply
> a template to.
>
> Yours,
> Christian
>
> PS. Mehul, I do have a stopgap solution for specifying the style template on
> a per-file basis. Place this somewhere in your Org document (e.g. before the
> first heading), and replace "/path/to/template.odt" with the path to your
> styles file.
>
> #+begin_src emacs-lisp :results silent :exports results
> (setq org-export-odt-styles-file "/path/to/template.odt")
> #+end_src
>
>
> On 10/18/11 6:32 PM, Mehul Sanghvi wrote:
>>
>> This may not be specific to org-odt, but maybe applies to Org itself.
>>
>> I have a LaTeX file which I use for my resume at the moment.  The
>> fonts that are being used with it are great for what I want.
>> How do I specify fonts that I want to use, rather then the defaults?
>> Do I have to do that through styles.odt ?
>> If so, is there a specific OPTION for specifying the style file to use
>> ?   That would be a nice enhancement if it is not already there.
>>
>> I may want to use different styles/fonts, etc. and probably do not
>> want to play around with the styles.odt file each time I make
>> changes to the styles.odt file.
>>
>>
>>
>>
>
>



-- 
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com

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

* Re: org-odt: specifying fonts
  2011-10-18 21:15   ` Mehul Sanghvi
@ 2011-10-19 14:35     ` Matt Price
  2011-10-19 15:16       ` Mehul Sanghvi
  2011-10-19 15:37       ` Jambunathan K
  2011-10-19 19:37     ` Christian Moe
  1 sibling, 2 replies; 12+ messages in thread
From: Matt Price @ 2011-10-19 14:35 UTC (permalink / raw)
  To: Mehul Sanghvi; +Cc: emacs-orgmode, mail, Jambunathan K

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

On Tue, Oct 18, 2011 at 5:15 PM, Mehul Sanghvi <mehul.sanghvi@gmail.com>wrote:

> Christian,
>
>      Thanks for the stopgap measure.  As for fonts, like styles, it
> would be easier, simpler and more elegant
> to be able to do that without having to edit styles.odt every time.
> This is not specific to org-odt.  It should be,
> at least I think so for now, to do this with any exporting backend.
>
> If you send me a styles.odt, and I do not like the fonts you are
> using, it becomes cumbersome to be editing the styles.odt
> for each font and making sure to change it in all possible places
> until I settle on a proper font I want to use.
>
> If I could instead specify the font in org file itself, it would be a
> matter of changing the header and re-generating the file.
>
> The ODT_STYLE is certainly a good enhancement.
>
> I think the problem here, Mehul, is that odt export works with styles, not
fonts.  So to do what you want, the exporter would need to be able to tweak
the styles manually(so, I guess, first run some kind of xml transform on the
stylesheet, then apply the stylesheet itself).  If there are hidden
inconsistencies in the original stylesheet, you may end up with
difficult-to-diagnose breakage. I'd definitely suggest just modifying hte
stylesheet and saving it somewhere safe.
m

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

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

* Re: org-odt: specifying fonts
  2011-10-19 14:35     ` Matt Price
@ 2011-10-19 15:16       ` Mehul Sanghvi
  2011-10-19 15:32         ` Jambunathan K
  2011-10-19 15:37       ` Jambunathan K
  1 sibling, 1 reply; 12+ messages in thread
From: Mehul Sanghvi @ 2011-10-19 15:16 UTC (permalink / raw)
  To: Matt Price; +Cc: emacs-orgmode, mail, Jambunathan K

On Wed, Oct 19, 2011 at 10:35, Matt Price <moptop99@gmail.com> wrote:
>
>
> On Tue, Oct 18, 2011 at 5:15 PM, Mehul Sanghvi <mehul.sanghvi@gmail.com>
> wrote:
>>
>> Christian,
>>
>>      Thanks for the stopgap measure.  As for fonts, like styles, it
>> would be easier, simpler and more elegant
>> to be able to do that without having to edit styles.odt every time.
>> This is not specific to org-odt.  It should be,
>> at least I think so for now, to do this with any exporting backend.
>>
>> If you send me a styles.odt, and I do not like the fonts you are
>> using, it becomes cumbersome to be editing the styles.odt
>> for each font and making sure to change it in all possible places
>> until I settle on a proper font I want to use.
>>
>> If I could instead specify the font in org file itself, it would be a
>> matter of changing the header and re-generating the file.
>>
>> The ODT_STYLE is certainly a good enhancement.
>>
> I think the problem here, Mehul, is that odt export works with styles, not
> fonts.  So to do what you want, the exporter would need to be able to tweak
> the styles manually(so, I guess, first run some kind of xml transform on the
> stylesheet, then apply the stylesheet itself).  If there are hidden
> inconsistencies in the original stylesheet, you may end up with
> difficult-to-diagnose breakage. I'd definitely suggest just modifying hte
> stylesheet and saving it somewhere safe.
> m
>
>


I will most likely end up it that way and using that as my workflow.
The font thing was
just something coming out from the fact that I do not know or
understand ODT styles.
Something new to learn now :)

Now I just got to figure out the fonts that Latex is using for my
resume and re-use those same ones
in my style and apply them correctly in the ODT styles.



-- 
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com

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

* Re: org-odt: specifying fonts
  2011-10-19 15:16       ` Mehul Sanghvi
@ 2011-10-19 15:32         ` Jambunathan K
  2011-10-19 15:39           ` Jambunathan K
  0 siblings, 1 reply; 12+ messages in thread
From: Jambunathan K @ 2011-10-19 15:32 UTC (permalink / raw)
  To: Mehul Sanghvi; +Cc: emacs-orgmode, mail


> The font thing was just something coming out from the fact that I do
> not know or understand ODT styles.  Something new to learn now :)

This is how you will change the fonts.

1. Export your resume.org to resume.odt (without using any custom
   styles)
2. Open resume.odt in LibreOffice
3. F11 - This will open the stylist window
4. In paragraphy styles, look for "Default". Right click this and modify
   as below
5. Change the "Times New Roman" etc etc to "Whatever"
6. Save the file as resume-style.odt
7. Now customize-variable org-export-odt-styles-file and point it to
   resume-style.odt

You are done.

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

* Re: org-odt: specifying fonts
  2011-10-19 14:35     ` Matt Price
  2011-10-19 15:16       ` Mehul Sanghvi
@ 2011-10-19 15:37       ` Jambunathan K
  1 sibling, 0 replies; 12+ messages in thread
From: Jambunathan K @ 2011-10-19 15:37 UTC (permalink / raw)
  To: Matt Price; +Cc: emacs-orgmode, mail, Mehul Sanghvi

Matt Price <moptop99@gmail.com> writes:


> I think the problem here, Mehul, is that odt export works with
> styles, not fonts.  So to do what you want, the exporter would need
> to be able to tweak the styles manually(so, I guess, first run some
> kind of xml transform on the stylesheet, then apply the stylesheet
> itself).  If there are hidden inconsistencies in the original
> stylesheet, you may end up with difficult-to-diagnose breakage. I'd
> definitely suggest just modifying hte stylesheet and saving it
> somewhere safe. 

You don't need to apply any set of xml transform or any such thing for
the case at hand.
-- 

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

* Re: org-odt: specifying fonts
  2011-10-19 15:32         ` Jambunathan K
@ 2011-10-19 15:39           ` Jambunathan K
  0 siblings, 0 replies; 12+ messages in thread
From: Jambunathan K @ 2011-10-19 15:39 UTC (permalink / raw)
  To: Mehul Sanghvi; +Cc: emacs-orgmode, mail

Jambunathan K <kjambunathan@gmail.com> writes:

>> The font thing was just something coming out from the fact that I do
>> not know or understand ODT styles.  Something new to learn now :)
>
> This is how you will change the fonts.
>
> 1. Export your resume.org to resume.odt (without using any custom
>    styles)
> 2. Open resume.odt in LibreOffice
> 3. F11 - This will open the stylist window
> 4. In paragraphy styles, look for "Default". Right click this and modify
>    as below
> 5. Change the "Times New Roman" etc etc to "Whatever"
> 6. Save the file as resume-style.odt
> 7. Now customize-variable org-export-odt-styles-file and point it to
>    resume-style.odt

Forgot the last step

8. Re-exporting any subsequent .org file will pick up the new font as
saved in resume-style.odt

> You are done.
>
>

-- 

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

* Re: org-odt: specifying fonts
  2011-10-18 20:04 ` Christian Moe
  2011-10-18 21:15   ` Mehul Sanghvi
@ 2011-10-19 17:54   ` Jambunathan K
  2011-10-19 18:15     ` Mehul Sanghvi
  2011-10-19 18:30     ` Christian Moe
  1 sibling, 2 replies; 12+ messages in thread
From: Jambunathan K @ 2011-10-19 17:54 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Mehul Sanghvi


> I agree with Mehul it would be great to have an option to specify a 
> styles file on a per-file basis. Something like:
>
>    #+ODT_STYLE: ~/org/odt-templates/cv.odt

I have gone with `#+ODT_STYLES_FILE: '[1]. Refer the docstring below for a
sample setting.

,----[ C-h v org-export-odt-styles-file RET ]
| org-export-odt-styles-file is a variable defined in `org-odt.el'.
| Its value is nil
| 
| Documentation:
| Default styles file for use with ODT export.
| Valid values are one of:
| 1. nil
| 2. path to a styles.xml file
| 3. path to a *.odt or a *.ott file
| 4. list of the form (ODT-OR-OTT-FILE (FILE-MEMBER-1 FILE-MEMBER-2
| ...))
| 
| [snip]
| 
| Use "#+ODT_STYLES_FILE: ..." directive to set this variable on
| a per-file basis.  For example,
| 
| #+ODT_STYLES_FILE: "/path/to/styles.xml" or
| #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")).
| 
| You can customize this variable.
`----

Hope it is OK.

Footnotes: 
[1] The name of the option is same as the upcased custom variable name
with `org-export-' prefix stripped. The same convention can be used for
any "future" per-file odt settings.
-- 

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

* Re: org-odt: specifying fonts
  2011-10-19 17:54   ` Jambunathan K
@ 2011-10-19 18:15     ` Mehul Sanghvi
  2011-10-19 18:30     ` Christian Moe
  1 sibling, 0 replies; 12+ messages in thread
From: Mehul Sanghvi @ 2011-10-19 18:15 UTC (permalink / raw)
  To: mail, Mehul Sanghvi, emacs-orgmode

On Wed, Oct 19, 2011 at 13:54, Jambunathan K <kjambunathan@gmail.com> wrote:
>
>> I agree with Mehul it would be great to have an option to specify a
>> styles file on a per-file basis. Something like:
>>
>>    #+ODT_STYLE: ~/org/odt-templates/cv.odt
>
> I have gone with `#+ODT_STYLES_FILE: '[1]. Refer the docstring below for a
> sample setting.
>
> ,----[ C-h v org-export-odt-styles-file RET ]
> | org-export-odt-styles-file is a variable defined in `org-odt.el'.
> | Its value is nil
> |
> | Documentation:
> | Default styles file for use with ODT export.
> | Valid values are one of:
> | 1. nil
> | 2. path to a styles.xml file
> | 3. path to a *.odt or a *.ott file
> | 4. list of the form (ODT-OR-OTT-FILE (FILE-MEMBER-1 FILE-MEMBER-2
> | ...))
> |
> | [snip]
> |
> | Use "#+ODT_STYLES_FILE: ..." directive to set this variable on
> | a per-file basis.  For example,
> |
> | #+ODT_STYLES_FILE: "/path/to/styles.xml" or
> | #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")).
> |
> | You can customize this variable.
> `----
>
> Hope it is OK.
>
> Footnotes:
> [1] The name of the option is same as the upcased custom variable name
> with `org-export-' prefix stripped. The same convention can be used for
> any "future" per-file odt settings.
> --
>


Awesome !!   Thanks Jambunathan

-- 
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com

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

* Re: org-odt: specifying fonts
  2011-10-19 17:54   ` Jambunathan K
  2011-10-19 18:15     ` Mehul Sanghvi
@ 2011-10-19 18:30     ` Christian Moe
  1 sibling, 0 replies; 12+ messages in thread
From: Christian Moe @ 2011-10-19 18:30 UTC (permalink / raw)
  To: Mehul Sanghvi, emacs-orgmode

On 10/19/11 7:54 PM, Jambunathan K wrote:
> #+ODT_STYLES_FILE: "/path/to/styles.xml"

Perfect. Thanks for the quick response!

Yours,
Christian

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

* Re: org-odt: specifying fonts
  2011-10-18 21:15   ` Mehul Sanghvi
  2011-10-19 14:35     ` Matt Price
@ 2011-10-19 19:37     ` Christian Moe
  1 sibling, 0 replies; 12+ messages in thread
From: Christian Moe @ 2011-10-19 19:37 UTC (permalink / raw)
  To: Mehul Sanghvi; +Cc: emacs-orgmode, Jambunathan K

Hi, Mehul,

It's not that I would be opposed to a fonts option, of course, but I 
don't see it as a priority or even necessary. As long as org-odt 
handles the document structure and semantics right, and allows 
attaching an external stylesheet, I think it's done its job.

There are other developments I'm more keen on, like a finalized set of 
documented header options for images (those often need to be set on a 
per-image basis), or the table styles Jambunathan's been experimenting 
with (OpenOffice, eat your heart out!), or simply the definitive 
integration of the odt exporter into core Org.

On 10/18/11 11:15 PM, Mehul Sanghvi wrote:
> As for fonts, like styles, it
> would be easier, simpler and more elegant
> to be able to do that without having to edit styles.odt every time.
> This is not specific to org-odt.  It should be,
> at least I think so for now, to do this with any exporting backend.

Some would say tinkering with fonts is a distraction from writing that 
having Your Life In Plain Text allows you to get away from. And the 
consistent use of styles and templates is anyway good word-processing 
practice.

But sure, this is possible in other backends. For html export (which I 
know better than latex), one can simply include a header like:

   #+STYLE: <style> * { font-family: Gentium; } </style>

to make every element use the Gentium font if available. If I need 
more than 2-3 STYLE headers to get a job done, though, I find it 
easier, simpler and more elegant to link to an external stylesheet.

HTML comes with the breathtaking power and simplicity of CSS styling; 
LaTeX comes with breathtaking power and ... well, at least it's in 
plain text that Org can pass on to the relevant backend. ODT is a 
slightly different story. Its styles are in XML that was not really 
meant to be hand-edited.

> If you send me a styles.odt, and I do not like the fonts you are
> using, it becomes cumbersome to be editing the styles.odt
> for each font and making sure to change it in all possible places
> until I settle on a proper font I want to use.

> If I could instead specify the font in org file itself, it would be a
> matter of changing the header and re-generating the file.

You'd still need to do the cumbersome work of making sure to change it 
in all possible places, though. Changing the Default paragraph style 
will typically change e.g. the linked Text Body style, too , but not 
the headings (they're linked with Heading). So at a minimum, you'd 
need options to modify both. And once fonts can be specified, users 
will want sizes, weights, colors, borders, etc. Sure, there could be 
an extensive options vocab a la:

   #+ODT_STYLE: "Default" :type para :font "Gentium" :size 12pt
   #+ODT_STYLE: "Heading" :type para :font "Arial" :size 16pt :weight 
bold :color blue :borders ...etc. etc. ...

But is it needed? While Latex, HTML and DocBook users should never be 
required to sully their hands with a GUI, when we use ODT we can 
reasonably be expected to open up an office application now and again 
to modify our templates.

Okay, #+END_RANT...

Yours,
Christian

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

end of thread, other threads:[~2011-10-19 19:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-18 16:32 org-odt: specifying fonts Mehul Sanghvi
2011-10-18 20:04 ` Christian Moe
2011-10-18 21:15   ` Mehul Sanghvi
2011-10-19 14:35     ` Matt Price
2011-10-19 15:16       ` Mehul Sanghvi
2011-10-19 15:32         ` Jambunathan K
2011-10-19 15:39           ` Jambunathan K
2011-10-19 15:37       ` Jambunathan K
2011-10-19 19:37     ` Christian Moe
2011-10-19 17:54   ` Jambunathan K
2011-10-19 18:15     ` Mehul Sanghvi
2011-10-19 18:30     ` Christian Moe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).