Can text spacing be adjusted by row around drop caps?

Hello, when using drop caps that are two lines tall, is there a method of setting the text position or margin of the first and second lines separately? For example, when the drop cap is an “A”, I’d like to move the first line closer to the top of the A but keep the second line further to the right of the bottom of the A.

Thank you.

And Fontwork don’t works here.

Why?
FontworkFakeDropcap.odt (28.4 KB)

Don’t know, but don’t work. See that the OP wrote “two lines”.
imagen

Just changed the size in your sample file:
imagen

Now (after a bit of testing) I see that the drop caps is higher than the following text. Anyway, FontWork don’t work with all characters (i.e., C, E, F, G, H, I, J, K, L, M, N, S, T, U, V, W, X, Y, Z). So, it works with A, B, D, O, P, Q, R.
imagen

DropCaps with FontWork.odt (18.4 KB)
LibreOffice 7.2.7.2 on Windows 10.

That looks definitely like a bug.

I don’t think this is possible with drop caps.

You could, however, use an image to take the place of a drop cap. You could use a contour wrap and edit the contour.

1 Like

I don’t think you can do it. A dropcap “isolates” one letter (more generally one character) from the rest of the flow and makes it as tall as the requested number of lines. This segregation “punches” a rectangle and removes it from the printing area. Thus the kerning table in the font definition cannot be used because of the difference between the dropcap and the rest of the paragraph.

In addition, the spacing adjustment is usually different on the various lines (think for example of an A as dropcap). As far as I know, no font provides such detailed information about the slope of the strokes composing the contour. This could be worked around by computing the “convex hull” for the dopcap but I know of no renderer implementing this. I you feel brave and have the skills for it, don’t hesitate to propose a prototype for it.

@TXDon suggests an image replacement for the dropcap. This is probably the only present workaround. The key is the transformation from a character to a graphical contour. There are tools for this (Inkscape could be one of them to provide an SVG image). The remaining difficulties would to to precisely scale the contour and to position accurately the image frame. I fear this positioning can’t be recorded in a “one-size-fits-all” frame style as every letter would probably require different parameters.

Thank you both for the suggestions. I didn’t realize it was such a challenge. When using HTML and CSS, I just wrap the first letter in a span, and wrap the number of letters to be capitalized in a second span. The font size of the first span is set to four times the normal font size and the right margin is set to that desired on the second row of the paragraph. Then the left margin on the second span is set to a negative value, drawing the first row of the paragraph closer to the top of the letter. And there are adjustments made for classes of letters depending upon where they are wider, such as a T versus an A versus and N, for example.

That reminds me of another general question I had, and I don’t mean to start a new topic within another, but is there a way to edit the XML or whatever is written in the background of Writer to attempt something similar? It would be nice at times to simply build the document by separating styles and content as done in HTML/CSS. For example, I have several block quotes, and if I’d like to alter their style, I have to change each one separately in Writer; but in CSS I can just change the class style and all the block quotes change. I have the document available on a web page and as a PDF built in Writer, and making changes to the web page is much easier through CSS than through Writer. But, perhaps, I’m not using Writer as efficiently as it should be used.

Thank you.

It would be nice at times to simply build the document by separating styles and content as done in HTML/CSS

That is almost exactly how styles in LibreOffice work. Have a read of the Writer Guide 7.1 particularly Chapters 8 and 9 for more information.

This is exactly what styles are intended for. Consider a style is strictly equivalent to a <span>. There are differences though. In CSS, “spans” are independent from each other: you can combine them anyway you like and any number you like. Write imposes a structure over styles. The first structuring is a layer approach:

  • Paragraph styles are at the lower level. They can’t overlap. They extend from a paragraph break to the next one. A paragraph always receives a paragraph style (no character sequence can live outside a paragraph style).
  • Character styles are in the next layer. There is no imposed synchronisation (a character-styled sequence can straddle a paragraph break). However, contrary to <span>, only one character style may be applied to any sequence.
  • Direct formatting is in the top layer. Attributes are individually applied to characters. You may consider this creates zillions of one-character “anonymous” styles. You conceptually separate direct attributes on paragraph-targeted and character-targeted subsets with the paragraph one sent to a layer intermediate between paragraph and character styles but the effect of the abstract model is the same in the 4-layer and the 3-layer variants.

There is no complex selection as in CSS to find the relevant style to apply. You just take the layers in order and apply the attributes (attributes can be either set, which forces their value onto the text, or unset , i.e. ~“transparent”, where they have no effect. Caution! Transparent state is not the same for binary attributes like check boxes as “unchecked”. They have 3 values: checked, unchecked and transparent.

If you consistently style your document, avoiding any direct formatting, you effectively separate contents from appearance. Direct formatting breaks this separation and prevents you from centrally controlling formatting.

I disagree with this statement.

In CSS, ou trigger the application of “styles” through selectors and the correct expression may quickly become complex. You are faced with specifying attributes in <span class="style1 style2"> or even <p class="style 3 style4"> and developing a selector pattern matching “equations” like

p  { … }
*[class ~= "style1" ] { … }
h1[class ~= "style2"] { … }

In Writer, styles have an explicit extent: paragraph for paragraph styles or the sequence of characters over which you applied the character style. This is simpler than computing a specificity factor in CSS and there is no surprise about where the change will happen.