Add an option to change the font size and font type in the editor

I really miss the possibility of changing the font size and font type in the editor for each word individually. This is something that exists in every text editing software (for example Word) and I really miss it.

1 Like

You can have it with Custom Styles (font color, background colour, classes)

Just learn how to add your own preferred values to configuration.

The problem is that if I change the font size all the other properties of the font are deleted.

I am not a coder so I can’t help much here but I know that all field and its content formatting in Anki is done in CSS or html. There are plenty of free tutorials on the Internet. For example:

There is also add-on that allows to edit in external editor but I don’t know of editor that could change format in html.

Here you have official support thread where you can ask for help.

Note that sometimes it is important to add !important to override other settings for example field styling.

font-size:36px !important;

I know how to write it. Thanks.
I want there to be a convenient button that applies the desired setting to the text. Both in size and font.

1 Like

Could you provide some more details about this, as you should perfectly be able to do this.

Technically speaking, Word is not a text editing software, it’s a word processing software. Understanding the difference between the two may help you understand what are the limitations when you edit notes with Anki.

  • A text editor is a software that allows you to edit files as if they were raw text. Raw text does not come with any formatting: for this reason, in text editors, you can’t change the font size, you can’t change the font, you can’t change the color, etc. (it does not mean that the editor won’t do that for you, just to make things nicer; it means that this formatting is not “saved” with the text, it’s only your editor that might understand some formatting is needed and apply it on its own). Examples are Emacs, Vim (and all its family), VS Code, gedit, … (the list goes on and on). These are mainly used by programmers.
  • On the other hand, a word processing software only allows you to edit files with a certain format, which allows them to “store” all the formatting you do. This means that a word processor will never show you what is actually stored in the file: instead, it will be rendered. Examples are, of course, Microsoft Word, Open Office Writer, LibreOffice Writer, … (and the list still goes on and on).

So, in reality, all word processors offer the possibility to format text, including changing font or font size. The question is now: is Anki’s editor a text editor, or a word processor? And the answer is: it’s in between.

Anki’s editor, as its name suggests, started as a plain text editor, which has incrementally been improved with features to enhance editing especially HTML. In particular, it will do some rendering, and it will hide
some formatting, but not all. Recently, these two aspects are being torn apart, on the one side by giving you a word processor, and on the other side a plain text editor (called the HTML editor). Even more rencently (since 1.50 or 1.51), the editor has been literally split in two: you can now have two editors “at once” for editing a single field. One will work as a word processor, the other one as a text editor.

So, why is it that we need both? The answer is that both have their advantages. A word processor is easier and more intuitive for most users, a text editor is more powerful. Slowly, the word processing capabilities of Anki’s editor are advancing, so maybe one day the text editor part won’t be that useful anymore, but developing a word processor that completely hides the implementation details is quite hard so it may take some time to reach that state. In the meantime, your best bet would be to learn the basics of HTML and CSS, so that you can always resort on the text editor when the regular Anki’s editor is not enough for your needs.

3 Likes

@ MIZMU
As a workaround:
In LibreOffice Writer you can edit font to your liking and save document as html. Open html it in some note / text application and copy formatting and paste to anki field when HTML editor is active Ctrl+Shift+X

Or use these add-on
https://ankiweb.net/shared/info/704320065
or
https://ankiweb.net/shared/info/16727059
and use some html editor with preview

1 Like

Is it possible to do this using setFormat?

I don’t know what setFormat is.

Have a look at this
OneNote importer
It supports html formatting.

I haven’t checked but this one may also support html formatting
Remote Decks: Anki collaboration using Google Docs

By the way, I think you should write what do you need it for, what subject do you study with Anki. Maybe other users that learn the same subject will come up with some ideas for you.

1 Like

Miss that functionality too :sob:, and the addon didn’t work for me, either.