Cuperino / QPrompt-Teleprompter

Teleprompter software for all video creators. Built with ease of use, productivity, control accuracy, and smooth performance in mind.
https://qprompt.app
GNU General Public License v3.0
383 stars 28 forks source link

.DOCX / ODT import issues (collection of referenced issues) #290

Open videosmith opened 4 days ago

videosmith commented 4 days ago

When importing a .docx file via QPrompt's External Tools and Applications link to LibreWriter, various decorations are altered or ignored.

Bug Description One attached document is a LibreWriter file, created by generating random text in an online generator, then copied and pasted into a new Writer document, altered, then saved as a .docx file. The other document is an .html save of QPrompt's file.

Steps to Reproduce

  1. Create source Writer document and save as .docx format
  2. Load/import into QPrompt
  3. Compare the two documents.

Expected behavior Overall appearance of the two documents should be similar (allowing for different margins and font sizes).

Paragraph 1: Center Justified honored, bold first sentence honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 2: Right Justified Cantarell Extra bold font honored, italic first sentence honored, text color sentence honored, left margin not honored.

Paragraph 3: Underscored first sentence honored, full justification honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 4: Bold underscored first sentence honored, font size change from rest of document (except for first sentence) honored - affected by the Bold/Underscore decoration? Right justification not honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 5: Italic/underscored first sentence honored, left justified honored, text background color honored (font color must be manually changed to black in Qprompt for readability-a 2 step operation for selecting black - another text color must be selected first), font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 6: Bold/italic/underscored first sentence honored, left justification honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

All paragraphs have double blank lines after import into QPrompt, instead of single blank lines between each.

Screenshots (optional) Screenshot_20241022_205628 Screenshot_20241022_205659

Debian 12 Bookworm LXDE AMD64, latest updates

Documents.zip

Cuperino commented 3 days ago

Thanks for taking the time to prepare this. If I may summarize this categorically, you've found the following behaviors:

  1. Text margins are never respected
  2. The default font in a document is not imported
  3. Right justification is not honored
  4. Default text color continues to be black after a highlight color has been set
  5. All paragraphs have double blank lines after being imported QPrompt

As for how should we act on this data:

  1. Presently margin and padding properties are intentionally filtered out to increase ease of use when pasting contents from a web browser, as web content can have arbitrary margin and padding to aid web design, which is inconvenient in this case.
    • @videosmith Are document margins something you would prefer to be respected? If so, it might be able to discriminate based on header meta-data from the document's source and treat margins coming from native office software different to how web browser contents are treated. The tricky part is finding a right way of dealing with margins that is consistent with all font scales. I've created a new issue for this: #291
  2. Different software has different default fonts they use as fallback. QPrompt's default is DejaVu, because it's readable and contains glyphs for most languages in the western world.
    • We should be able to detect the default font from the document's metadata and set that to be the default font early in the filtering process. This process however would only work for imported documents, not for text pasted from those same formats, as text being copy-pasted lacks that information in its metadata. I've created a new issue for this: #292
  3. Right justification not honored... I'll need to look into this. You may have found a bug. I've created a new issue for this, tho whether this is actually a bug remains to be confirmed: #293
  4. "Automatically changing the default text color after a highlight color has been set" is a quality of life feature implemented by Microsoft Office and other office suites no more than a decade ago. When highlighted text is copied, QPrompt only receives the metadata from the highlight, there's no data on text color coming-in because that is technically still the default. For the color to match, QPrompt would have to match the logic from those programs, which would in turn make it not match the logic of other programs, such as web browsers. That however shouldn't be an issue, for we can look at import metadata to tell when the text comes from a document and treat that text differently. Nevertheless, the more complex the logic is, the harder it can be to maintain. For that reason I'd like to keep this logic as simple as possible. The best we can do is try to replicate the behavior from Microsoft Office and LibreOffice. That is, we should treat the text-color metadata as non-existent and store only highlight information, but treat that highlight information as something that sets both color and highlight. I'm honestly not sure of how to program this, but that is how the logic should go to match the office suites. This is a duplicate of: #13
  5. All paragraphs have double blank lines after import into QPrompt. This may be a duplicate of: #205 and/or of #179