Character and Paragraph Styles

The attached LO_Code_StyleIssues.odt (128.2 KB) document has been formatted with the Code Colorizer Formatter. What are the end of line characters?

When the file is saved as a text file in Win10 and viewed in Hex every end-of-line is 0d 0a characters. I can see some are formatted as Liberation Mono 10pt and others as Courier New 11pt. Reformatting the end of lines characters doesn’t change them.

There is no “end of line characters” in your file. If you refer to these:

image

then they are just visual indicators showing paragraph (not line!) end, and there is also no character in Writer’s document model that it represents (and also in the ODF: the paragraph is contained completely inside an XML element, and its end is not designated by characters other than XML element closing tag).

The font used for the markers is the same that is assigned to the paragraph itself. Your code lines are formatted with Courier New, and your comment lines are formatted with Liberation Mono.
Actually, there is a _OOoComputerSpecial character style applied to the end of the paragraphs showing the Courier New.

You might want to re-define the font for the OOoComputerCode character style, which properly defines the font for its children - so you can do it in a single place.

1 Like

A very insightful answer. It’s clear now the code lines are converted to paragraphs in writer and the “end of line characters” are Formatting Marks. I hadn’t noticed the macro added OOoComputerCode, displayed collapsed by default and the parent of many Character Styles.

There is no “enf of line” characters in Writer.

Lines do not exist per se. They are a consequence of text flow. When a line is full and there is more data for this paragraph, a new line is allocated for the subsequent text. You won’t find any “EOL” character in the ODF XML representation of a Writer document.

When you export the document as a plain text file, all formatting information is stripped off and document layout is translated (very approximately) into plain text concepts: a single font face, spaces for alignment (right, center or tab stops) and OS markers for EOL (CR+LF under Windows, LF under *Nix, CR for other OS’s).

Now what is the relation between Character and Paragraph Styles, your question about EOL characters and the Code Colorizer Formatter extension? If you expect a useful answer, explain your purpose, define the goal and tell us where you see a difficulty.

PS: why are there sections in your sample? They are totally useless as you don’t change the number of columns. They only potentially make your document less stable and need more resources to manage.

1 Like