First letter styling?

Absolutely! I really want to get this right structurally, so I really want to adopt the “styles” workflow in both creation and subsequent editing and maintenance. My day-job has involved significant software engineering, so working cleanly with programming concepts is dear to my heart.

I new to working at this sort of level with LO, but want to “get it right”. I had mentioned the CSS ::first-letter analogy because that’s working cleanly for me in the original web version of this project. So my starting point is looking for something in LO that feels structurally similar to that CSS, because that’s exactly the concept I’m after: for these sort of poetry-viewpoint verse-lines (probably represented in LO as “paragraphs”), can I apply visual emphasis to the first letter? A sufficient minimum for that “visual emphasis” is simply “bold”.

This is the dropcap feature. It is configured in the Drop Caps tab of any paragraph style. You can assign a character style to the effect to make it different from general paragraph formatting.

Unfortunately, there are two limitations:

  • the feature takes ownership of the dropcap size, i.e. font size specified in the character style is ignored
  • if the paragraph has only one line (or more generally fewer lines than what is requested by the settings), the number of lines for the dropcap is reduced to the number of lines in the paragraph
    In other words, with a single line verse, your drop cap has the same height as the rest of the line. You can only play with weight, face or colour. See the second paragraph in my sample or screenshot.

Given that Drop Caps doesn’t do the job for single lines then a simpler way to select the first character of left -aligned text is to

  1. Create a character style from Default character style and style it as you like, maybe name it Acrostic
  2. Click Edit > Selection Mode > Block Area (Alt+Shift+F8)
  3. Select the first letter of the entire text then double click Acrostic character style to apply it.

This works for paragraphs and for line breaks
Acrostic.odt (12.9 KB)

Maybe you could volunteer to fix the bug report? Developers | LibreOffice - Free and private office suite - Based on OpenOffice - Compatible with Microsoft

Yes, I could look into attempting it. But while all my software work has been on UNIX/Linux, my LibreOffice is WIndows-11, an environment where I have never done any software development at all!

But prior to that we need to clarify:

  • have I simply overlooked a facility that is already there?
  • is my request a bug… in which case “fix” is the right way forward
  • is my request a new feature… in which case does it need a proposal/discussion, and where?

Thanks for the encouragement to take the next steps.

IMHO, yes.

The dropcap feature is implemented according to traditional typography where the first letter (or word) is “inset” inside the paragraph for a given number of lines. Consequently, the height is computed internally by the feature and overrides whatever is specified in the character style.

Your need is a bit different. It is not a “dropcap” because you want the first character to protrude over the first line.

I think a similar technique could be implemented using some parameters from the dropcap such as number of letters or words to consider, application of a character style but without font size override. The “protruding” letter would be aligned on the same base line as the rest.

The requirement here is simple “automatic” application of a character style from configuration in the paragraph style.

There are a few ways of applying a character style: as you type, block select and then apply, Find and Replace the first letter of every line break out paragraph. All described here.

Or you could use drop caps as defined by @ajlittoz

You could add yourself to the CC list for the drop cap for single line bug report, this increases the weight of the report which can make it more likely to attract the attention of a developer

Cheers, Al

Do you mean 70180? I’m already there and added a comment (and myself Cc:) yesterday.

If not 70180, do you have another in mind, please?

OK. Where, please, should I raise the proposal? Is there a development forum? (I’m new to this level of interaction with LO.)

BTW, I’m not really after protrusion. Merely applying existing styling character-style techniques (bold, italic, colour, etc.) in a “first-letter” or “first-word” paragraph style… the sort of thing that novice users would do as they type with the “bold” and “italic” buttons, but ideally (and especially on a larger, more systematic scale) should be done with styling.

I had come to Drop Caps simply because it was vaguely close and already there. But I’m happy to have this independent of Drop Caps (although I realise there is probably some overlap). So rather than thinking “start from Drop Caps and adapt”, instead think “independent but being aware of potential interaction with existing DC mechanism”.

On TDF Bugzilla. File a bug report. Prefix the title with FEATURE REQUEST to make clear you solicit an improvement.

I used word “protrusion” to emphasise that presently the drop cap feature disables font size in the character style to force its own idea about size. But other attributes are honoured.

Probably the simplest request is to ask to drop the “count of line filtering” where it is required to be larger or equal to 2. If this limit is lowered to 1, then Drop Cap can be used without modification (except perhaps to allow font size modification when count of lines is 1).

Once you have filed up your letter to LO Santa Claus, report the bug as tdf#123 where 123 is the bug number so that I can CC to it and thus “upvote” it.

1 Like

@ajlittoz: Many thanks for your guidance on this. It’s been most useful. I hope to draft the “feature request” as a bugzilla item during the week.

I’m not a typographer at all. But a Google search suggests that term “lead-in” seems to capture the variability I had been struggling to express here. The article below seems to give a good overview, with many examples of the variation that such a feature should perhaps take into consideration.

@ajlittoz: tdf#170006

For what you indicate, the best way is to use a character style for each first letter of a line or paragraph.

For an automated process change all (or some) first letters of the document, I can recommend you the AltSearch extension >> AltSearch » Libreoffice Extensions

When in Altseach

Search for \p\l Find paragraph endings followed by any letter

Search for \n\l Find line breaks followed by any letter

Replace &\C{Destaque mayor} Apply the “Destaque mayor” character style (in this case) to the found text

image

1 Like

Code for search: \n\l
Code for replace: &\C{Stark betont}

AltSearch.oxt could not perfectly do that in my case. The highlighting of the first letter was successful. Then I got an error code (see below).
I closed AltSearch.oxt - the 1st letters were still highlighted - and applied a character style via Stylist.


Error code:
1686 seznam.addItem(neco,0)



The & in the replace line of AltSearch.oxt was (automatically) replaced with a backslash.


Version: 25.8.3.2 (X86_64) Build ID: 8ca8d55c161d602844f5428fa4b58097424e324e CPU threads: 4; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: de-DE Calc: threaded

@Grantler have you AltSearch version 1.5.2.0 or newer? The manual how to try the newest branch is described on Github.

There was bug #74 for initial & in F&R comboboxes, but I hope it was solved by fix #119.

Version 1.5.2.0 or newer is without problems on my computer (also Libre 25.8.3.2 and Win10x64)

1 Like

Oh, I checked: I used AltSearch.oxt 1.4.2 2/2017

When using the newer version AltSearch.oxt 1.5.2.0 there is no problem. Thank you for the hint!