Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bold italics are not supported #177

Closed
zh-pan opened this issue Nov 26, 2022 · 39 comments
Closed

Bold italics are not supported #177

zh-pan opened this issue Nov 26, 2022 · 39 comments
Assignees
Labels

Comments

@zh-pan
Copy link

zh-pan commented Nov 26, 2022

If I write Bold&italics, the result is incorrect.

***Bold&italics***
@zh-pan
Copy link
Author

zh-pan commented Nov 26, 2022

image

@pbek
Copy link
Owner

pbek commented Nov 26, 2022

I don't think we were supporting mixing styles, did we, @Waqar144?

@pbek pbek added the question label Nov 26, 2022
@Waqar144
Copy link
Contributor

It is supported, try with a different font.

I doubt its broken as the relevant code hasn't been touched in at least a year

@zh-pan
Copy link
Author

zh-pan commented Nov 27, 2022

Thanks reply.
I try debug code, and find something with:

if (isStrong) {

Code above only bold and italic logical branches, lack mixing styles.
So can you help me how to fix this?

@zh-pan
Copy link
Author

zh-pan commented Nov 27, 2022

I try fix this. And only make little change for supporting mixing styles. The result like this:
image

But I don't know this change Whether it will bring side effects, because I didn't spend much time looking at the rest of the code.

Can I make a pr?

@Waqar144
Copy link
Contributor

It is broken since 5d990c5.

@Waqar144
Copy link
Contributor

other broken stuff

image

@zh-pan
Copy link
Author

zh-pan commented Nov 27, 2022

Yes, setFont will override Bold or Italic. So I add a new font BoldItalic. like this:

image

And BoldItalic:

image


It is broken since 5d990c5.

Or delete the two fmt.setFont can work, too?

@Waqar144
Copy link
Contributor

Font needs to be overwritten only if it was set / different. Just setting the font always is incorrect. You can test with QOwnNotes whether your change works for both cases i.e., when a font is set or not. (Read the linked QOwnNotes issue)

Adding BoldItalic is not needed.

@pbek
Copy link
Owner

pbek commented Nov 28, 2022

@Waqar144, thank you.
Yes, best investigate in QOwnNotes, if you are using that, @zh-pan.
Those styles were never planned to work in conjunction in QOwnNotes.

@pbek
Copy link
Owner

pbek commented Nov 28, 2022

And please open an issue in QOwnNotes.

@pbek
Copy link
Owner

pbek commented Nov 29, 2022

I'll add that with pbek/QOwnNotes#2676.

@pbek pbek closed this as completed Nov 29, 2022
@Waqar144
Copy link
Contributor

This is a qmarkdowntextedit bug, it can't be fixed in QOwnNotes

@pbek
Copy link
Owner

pbek commented Nov 29, 2022

Ah, I had to little sleep.

@pbek pbek reopened this Nov 29, 2022
@pbek
Copy link
Owner

pbek commented Nov 29, 2022

I didn't even saw it was in markdownhighlighter.cpp directly...

image

@pbek pbek added bug and removed question labels Nov 29, 2022
@pbek pbek self-assigned this Nov 29, 2022
@zh-pan
Copy link
Author

zh-pan commented Nov 29, 2022

Yes. You can remove this commit's change(5d990c5 ).

Or make a new format with mixing styles.

@Waqar144
Copy link
Contributor

I think to fix it, one needs to check if the font is something different and then change? like the other checks below. Not sure though

@pbek
Copy link
Owner

pbek commented Nov 29, 2022

I already fixed it (see screenshot), it's not committed yet.

@pbek
Copy link
Owner

pbek commented Nov 29, 2022

Should be fixed now.

@zh-pan
Copy link
Author

zh-pan commented Nov 30, 2022

That's great!

@pbek pbek closed this as completed Nov 30, 2022
@zh-pan
Copy link
Author

zh-pan commented Nov 30, 2022

Windows will be crash when I use this commit. When input the fifth character '*'.
***1*: Note: The last '*' key down will crash.

I want know this isn't my problem?

image

@zh-pan
Copy link
Author

zh-pan commented Nov 30, 2022

I'm sure this commit caused the error. It also appears when I compile with the original project.

@zh-pan
Copy link
Author

zh-pan commented Nov 30, 2022

I'm sure this commit caused the error. It also appears when I compile with the original project.

  • windows 10 LTSC
  • vs2022
  • Qt6.4

Qt creator will crash, too.

@pbek
Copy link
Owner

pbek commented Nov 30, 2022

It also appears when I compile with the original project.

What original project?

Qt creator will crash, too.

Qt creator crashes!?

@pbek
Copy link
Owner

pbek commented Nov 30, 2022

The commit just uses https://doc.qt.io/qt-5/qtextcharformat.html#setFontFamily...

@Waqar144
Copy link
Contributor

Can you use the debugger to get a backtrace when the assert hits?

@zh-pan
Copy link
Author

zh-pan commented Dec 1, 2022

I found problems with using qmarkdowntextedit as a 3rd party library in VS2022, then I tried to build QMarkDowntextedit-exe using the qmarkdowntextedit project and also got an error. I also tested compiling qmarkdowntextedit-exe in Qt creator with the same error. mingw and msvc2019 were used, respectively.

@zh-pan
Copy link
Author

zh-pan commented Dec 1, 2022

image

@zh-pan
Copy link
Author

zh-pan commented Dec 1, 2022

image

@pbek
Copy link
Owner

pbek commented Dec 1, 2022

Hmmm... I don't have any issues under Windows with Qt 5.11.

@pbek
Copy link
Owner

pbek commented Dec 1, 2022

What's the content of _formats[Bold].fontFamilies() for you if you output it e.g. with qDebug()?

@Waqar144
Copy link
Contributor

Waqar144 commented Dec 1, 2022

He is using Qt 6.4, it will easily crash there

@pbek
Copy link
Owner

pbek commented Dec 1, 2022

I need to wait until I'll hit a box where I've Qt6 running then...

@Waqar144
Copy link
Contributor

Waqar144 commented Dec 1, 2022

Then best not bump it in QON till its properly fixed.

@pbek
Copy link
Owner

pbek commented Dec 1, 2022

There is no issue with the Qt5 builds as far as I'm aware of.

@Waqar144
Copy link
Contributor

Waqar144 commented Dec 1, 2022

if there is no qt6 end user build, then it would be fine. But its trivial to fix either ways.

@pbek
Copy link
Owner

pbek commented Dec 1, 2022

Feel free to make a PR if you have faster access than me to a Qt6 box then. 😉

@Waqar144
Copy link
Contributor

Waqar144 commented Dec 2, 2022

Open up master, i will push a fix ;)

pbek added a commit that referenced this issue Dec 5, 2022
@pbek
Copy link
Owner

pbek commented Dec 5, 2022

Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants