Bug 70180 - Enhance Drop Caps effect to support Raised, Sunken and Dropped initials
Summary: Enhance Drop Caps effect to support Raised, Sunken and Dropped initials
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.2.3 release
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL: https://drafts.csswg.org/css-inline/#...
Whiteboard:
Keywords:
: 90355 103997 120635 136080 (view as bug list)
Depends on:
Blocks: Paragraph-Drop-Caps
  Show dependency treegraph
 
Reported: 2013-10-06 04:04 UTC by Y
Modified: 2023-03-11 21:47 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments
Drop caps in Microsoft Word (7.68 KB, image/png)
2017-08-21 12:26 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Y 2013-10-06 04:04:19 UTC
Use case: I want to highlight the first word in a paragraph.

I could do so by creating a new character style with the required highlighting, then define a new paragraph style using Drop Caps for the Whole word.

Currently the Lines entry in the Drop Caps tab of the Paragraph Style must be integer and more than 2.  I wish I could enter 1 in that field.

Extra bonus:  I wish that if Whole word is ticked, Number of characters be interpreted as number of words rather than being grayed out. 

Thank you for your consideration.
Comment 1 Mike Kaganski 2013-10-06 07:47:14 UTC
Thank you for reporting.
This is a valid enhancement request. Setting to NEW.

> Currently the Lines entry in the Drop Caps tab of the Paragraph Style must be
> integer and more than 2

A small correction. Currently it must be 2 or more.
Comment 2 Y 2013-10-08 00:42:33 UTC
Can somebody coach me into the code base?  this look like the kind of fix that a newbie could attempt.  I have some experience patching and building fairly large projects like the Linux kernel.  If a kind person can point me in the right direction, where to get the code from and how to build it in Ubuntu, I can have a go at implementing my request.
Comment 3 Mike Kaganski 2013-10-08 08:53:34 UTC
(In reply to comment #2)
I would begin at sw/source/core/text/txtdrop.cxx (it looks promising).

But even before that, I would recommend you to read ODF documentation (https://www.oasis-open.org/standards#opendocumentv1.2).
Specifically, OpenDocument spec part 1.

17.9 <style:drop-cap>
> The <style:drop-cap> element specifies if the first character or more of a
> paragraph is displayed in a larger font, that spans multiple lines.
> The <style:drop-cap> element is usable within the following element:
> <style:paragraphproperties> 17.6.
> The <style:drop-cap> element has the following attributes: style:distance 19.473,
> style:length 19.492, style:lines 19.494 and style:style-name 19.514.
> The <style:drop-cap> element has no child elements.

19.492 style:length
> The style:length attribute specifies the number of characters that are
> displayed in a larger font.
> The defined values for the style:length attribute are:
> ● word: specifies a set of characters to be displayed in a larger font.
> ● a value of type positiveInteger 18.2
> Note: What will be treated as a “word” by a consumer is locale specific.
> The default value for this attribute is 1.
> The style:length attribute is usable with the following element: <style:drop-cap> 17.9.
> The values of the style:length attribute are word or a value of type positiveInteger 18.2.

19.494 style:lines
> The style:lines attribute specifies the number of text lines which a font
> spans. If the value of this attribute is 1, <style:drop-cap> is disabled.
> The default value for this attribute is 1.
> The style:lines attribute is usable with the following element: <style:drop-cap> 17.9.
> The style:lines attribute has the data type positiveInteger 18.2.

This makes this not an easy affair, because your proposal requires the change in the standard. It's not impossible, just more work.
Comment 4 Y 2013-10-16 14:10:45 UTC
Thank you for the pointer, Mike.  I am at a much earlier stage:
* where do I get the source code from so that I can go int sw/source/core/text/txtdrop.cxx
* how do I build it and, ideally, install it in parallel to the default distributed package currently critically important for my productivity without affecting my system?

I am finishing my mid-term exams in a week and will hopefully find some spare time to get a build toolchain up and running.
Comment 5 Adolfo Jayme Barrientos 2017-08-15 19:57:35 UTC
*** Bug 103997 has been marked as a duplicate of this bug. ***
Comment 6 Yousuf Philips (jay) (retired) 2017-08-21 12:04:10 UTC
I dont get the idea behind this as drop caps is intended to have more than one line.

"With a drop cap, the initial sits within the margins and runs several lines deep into the paragraph, indenting some normal-sized text in these lines. This keeps the left and top margins of the paragraph flush." - https://en.wikipedia.org/wiki/Initial

@Heiko, @Regina, @Stuart: Your thoughts.
Comment 7 Mike Kaganski 2017-08-21 12:14:10 UTC
(In reply to Yousuf Philips (jay) from comment #6)
> I dont get the idea behind this as drop caps is intended to have more than
> one line.

While the classic implementation is as you pointed out, the idea behind the whole concept is to *highlight* the first character/word of a paragraph/chapter/... - and *typically* highlighting occurs not only by different font, but also by different size and spanning across several lines.

But the OP's idea is a plausible extension of the concept, where N in {span across N lines} could be 1, and highlighting is done only by different font.

Currently one can only implement this using manual assignment of a special style to first parts of corresponding paragraphs. Which, of course, might lead to errors (when some are erroneously skipped, or a highlighted portion got shifted by a find/replace operation and later the highlight wasn't cleared).
Comment 8 Heiko Tietze 2017-08-21 12:26:46 UTC
Created attachment 135700 [details]
Drop caps in Microsoft Word

Word allows a minimum of 1 at "Lines to drop" (default is 3). Makes no sense to me, but it also doesn't harm. An advantage could be the improved interoperability.

Exported from Word as ODT and get this in the file <style:drop-cap style:length="1" style:lines="1"/>, though in the paragraph properties the drop caps are disabled.

Regarding the "extra bonus" I'd say it's out of scope and not covered by the format.
Comment 9 Regina Henschel 2017-08-21 15:01:14 UTC
I have got some books about typography and there I do not find any reason to not allow a one-line drop cap. Not only word but InDesign allows it too.

The ODF schema has only the restriction "positive integer" not "at least 2". A file with style:lines="1" would still be valid against the schema. Only the description in 19.494 style:lines needs to be changed.
Comment 10 Adolfo Jayme Barrientos 2017-09-03 08:56:07 UTC
*** Bug 103997 has been marked as a duplicate of this bug. ***
Comment 11 V Stuart Foote 2017-09-03 14:12:52 UTC Comment hidden (obsolete)
Comment 12 Buovjaga 2017-09-05 16:52:38 UTC Comment hidden (obsolete)
Comment 13 Heiko Tietze 2017-09-07 15:28:24 UTC
We talked about this topic in the design meeting and suggest to follow W3C CSS working group nomenclature (bug 103997#c15).
Comment 14 Y 2017-12-30 15:55:26 UTC
Apology for not being familiar with W3C CSS working group nomenclature.  I will leave taxonomy to the experts and limit myself to express feature requests.  Bug 103997 got me thinking.  My original request was for a simple small change to the existing UI, but if bug 103997 is to be marked as duplicate, and I agree it is for reasons I wrote on that thread, then the request in this bug has to be fleshed out.  My 2 cents below.

USE CASE: there are many different creative ways to draw attention to the start of a paragraph.  Users will eventually think of new ways and a good implementation of currently popular ways of making the start of a paragraph stand out will allow for future development (3D printing anyone?).

IMPLEMENTATION:
(a) flexible definition of what is the first part of the paragraph
(b) incremental implementation of stand-out features


(a) DEFINITION OF THE FIRST PART OF THE PARAGRAPH
- letter: first number of letters (1->n)
- word: first number of words (1->n)

(b) STAND-OUT FEATURES
- STYLE
- HEIGHT, as the number of lines (my original request was just to allow for HEIGHT=1)
- SPACING, as three choice: punch below, punch above, white space above (this will cover the requests in bug 103997)

Most important: leave this open to creative ideas of other ways to make the beginning of a paragraph stand out.  A graphic image?  A lookup into a sequence of graphic images based on the letter of the alphabet with which the paragraph starts?
Comment 15 V Stuart Foote 2018-10-15 21:28:43 UTC
*** Bug 120635 has been marked as a duplicate of this bug. ***
Comment 16 V Stuart Foote 2020-09-03 20:02:01 UTC
*** Bug 136080 has been marked as a duplicate of this bug. ***
Comment 17 Clarc 2020-09-04 09:28:39 UTC
As my bug (https://bugs.documentfoundation.org/show_bug.cgi?id=136080) was marked as a duplicate of this one, I'd like to share my thoughts on optimal implementation.



The easiest (and probably most useful) implementation could be to add another Option below "Lines" and renaming the Lines-option:

        Height in Lines  [ 3  |-|+]
   Protrusion into Text  [ 2  |-|+]

The above mentioned example would then produce the middle text in the following picture: https://d33wubrfki0l68.cloudfront.net/f61ec9299e5d39face7dd612074000df41b3e064/2372b/assets/images/blog/2017/initial-letter/sunken-raised-drop-caps-2240.jpg

        Height in Lines  [ 3  |-|+]
   Protrusion into Text  [ 3  |-|+]

Would result in the right text in the picture and

        Height in Lines  [ 3  |-|+]
   Protrusion into Text  [ 1  |-|+]

would be the left text.
By default, Protrusion could always be set to be equal to [Height in Lines], if we want to avoid forcing users to set additional parameters.
Comment 18 V Stuart Foote 2020-09-07 15:12:06 UTC
*** Bug 90355 has been marked as a duplicate of this bug. ***
Comment 19 Eyal Rozenberg 2023-03-11 21:11:48 UTC
Good idea.

Also, perhaps we should support setting a CS for the drop-cap contents. Opening a bug for that.