Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

It should be possible to change the base font size. #17

Open
Igrium opened this issue Jul 10, 2021 · 1 comment
Open

It should be possible to change the base font size. #17

Igrium opened this issue Jul 10, 2021 · 1 comment

Comments

@Igrium
Copy link

Igrium commented Jul 10, 2021

Right now, the base font size for markdown-text is hard-coded at 16, and is not overwritable by CSS. This is problematic when trying to fit a markdown section into an existing UI. There should be an -mdfx-font-size property like there is -mdfx-font-color.

@sghpjuikit
Copy link

It is not hardcoded in Java code, but in default stylesheet bundled with the component.

1 If you getStylesheet().add(yourCss), you should be able to override all styling.

2 You may also discard the original styling which gives you full styling control from all javafx styling mechanisms. in order of priority (see javafx.css.StyleOrigin):

         object: MarkdownView() {
            init {
               stylesheets.clear()
            }
         }

E.g., I apply my own stylesheet on window root, which has an unfortunate effect that the bundled stylesheet, which is pinned on the component, takes priority over mine. I solved this by copying all the styling from bundled stylesheets into my own (where I change all values anyway) and discarding the original styling.

3 markdownNode.setStyle("your css code") should work as well, because it has greatest priority (even greater than java code)

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

No branches or pull requests

2 participants