# Add text functionality to schematic editor

**URL:** <https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19>\
**Category:** Improvement Ideas\
**Created:** [December 14, 2018, 7:30pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19 "2018-12-14T19:30:10Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![import](https://avatars.discourse-cdn.com/v4/letter/i/4da419/32.png) [@import](https://librepcb.discourse.group/u/import)\
**Post date:** [December 14, 2018, 7:30pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/1 "2018-12-14T19:30:10Z")

</div>

_From @dbrgn on Thu Nov 01 2018 19:43:34 GMT+0000 (UTC)_  
  
Right now text cannot be placed in the schematics. Would be nice to have that.

## Desired functionality

- Place text blocks on the schematics
- Allow customizing font size and weight

## Brainstorming

- Allow markdown formatting and only render on save (simplifies implementation)
- Should font selection be per-block or for the entire sheet?
- Format classes (heading1, heading2, text, small) would be nice to be able to achieve consistent formatting  
  
_Copied from original issue: [https://github.com/LibrePCB/librepcb-rfcs/issues/33](https://github.com/LibrePCB/librepcb-rfcs/issues/33)_

---

<div class="post-metadata">

**Author:** ![import](https://avatars.discourse-cdn.com/v4/letter/i/4da419/32.png) [@import](https://librepcb.discourse.group/u/import)\
**Post date:** [December 14, 2018, 7:30pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/2 "2018-12-14T19:30:14Z")

</div>

_From @ouabache on Fri Nov 02 2018 16:09:08 GMT+0000 (UTC)_  
  
Yes for Text.  
Select font,size and color.  
Do not place on snap grid,You need a finer adjustment for location.

If you do place on snap grid then allow for the 9 placement modifiers: above left,above,above right,left ,cent etc.

John Eaton

---

<div class="post-metadata">

**Author:** ![import](https://avatars.discourse-cdn.com/v4/letter/i/4da419/32.png) [@import](https://librepcb.discourse.group/u/import)\
**Post date:** [December 14, 2018, 7:30pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/3 "2018-12-14T19:30:14Z")

</div>

_From @ubruhin on Sat Nov 03 2018 22:31:51 GMT+0000 (UTC)_  
  
Support for text in schematics is needed for sure. But I’m not sure about Markdown because it’s very limited and many EDA users probably don’t know Markdown and thus aren’t comfortable with it. But I would agree to use Markdown just as an optional, alternative input method for texts.

Qt would support a [subset of HTML](http://doc.qt.io/qt-5/richtext-html-subset.html) out of the box. With that it shouldn’t be too hard to support rich text in LibrePCB…

Choosing fonts is tricky. Actually only fonts bundled with LibrePCB should be used, the use of system fonts would break portability of LibrePCB projects.

---

<div class="post-metadata">

**Author:** ![import](https://avatars.discourse-cdn.com/v4/letter/i/4da419/32.png) [@import](https://librepcb.discourse.group/u/import)\
**Post date:** [December 14, 2018, 7:30pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/4 "2018-12-14T19:30:14Z")

</div>

_From @dbrgn on Sun Nov 04 2018 11:27:00 GMT+0000 (UTC)_  
  
\> With that it shouldn’t be too hard to support rich text in LibrePCB…

Sure, but if you want to do invisible markup (bold/italic/etc) by marking a span of text and clicking a format button, you’ll descend into the seven hells of building rich text editors 🙂 You probably know from using those how buggy they can be at times.

The advantage of markdown is that it’s _visible_ how the markup should be applied, so you won’t have issues with incorrectly nested markup (or it will be obvious why it doesn’t work).

---

<div class="post-metadata">

**Author:** ![p12tic](https://yyz2.discourse-cdn.com/free1/user_avatar/librepcb.discourse.group/p12tic/32/26_2.png) [@p12tic](https://librepcb.discourse.group/u/p12tic)\
**Post date:** [December 15, 2018, 8:15pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/5 "2018-12-15T20:15:43Z")

</div>

One major advantage of markdown is that’s its really simple and basically an industry standard. The problems with tying to the subset of html supported by Qt are numerous. The supported html is rather complex already and it’s possible to write rather complex webpages with it (it supports a subset CSS and so on). If users can abuse something, they will. Additionally, tying to Qt would mean we don’t have control over the functionality. Imagine if further down the road Qt started supporting more tags or less. Then users using newer version of Qt would observe different behavior of librepcb compared to users using old version of Qt. I guess we want to avoid that.

---

<div class="post-metadata">

**Author:** ![ubruhin](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@ubruhin](https://librepcb.discourse.group/u/ubruhin)\
**Post date:** [December 16, 2018, 12:23am UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/6 "2018-12-16T00:23:29Z")

</div>

> [@p12tic](#):
>
> Additionally, tying to Qt would mean we don’t have control over the functionality. Imagine if further down the road Qt started supporting more tags or less. Then users using newer version of Qt would observe different behavior of librepcb compared to users using old version of Qt. I guess we want to avoid that.

Yes, I absolutely agree. But the problem is when not using Qt’s HTML renderer, we would have to implement it by ourselves, which requires very high effort. Using Qt for that would be much simpler. Maybe we could somehow restrict the supported HTML subset by ourselves, so that we can control which HTML tags are allowed and which not? That would be at least a good compromise in my opinion…

---

<div class="post-metadata">

**Author:** ![p12tic](https://yyz2.discourse-cdn.com/free1/user_avatar/librepcb.discourse.group/p12tic/32/26_2.png) [@p12tic](https://librepcb.discourse.group/u/p12tic)\
**Post date:** [December 16, 2018, 12:34am UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/7 "2018-12-16T00:34:56Z")

</div>

Maybe we could translate Markdown to what’s supported by the Qt HTML renderer?

---

<div class="post-metadata">

**Author:** ![dbrgn](https://yyz2.discourse-cdn.com/free1/user_avatar/librepcb.discourse.group/dbrgn/32/25_2.png) [@dbrgn](https://librepcb.discourse.group/u/dbrgn)\
**Post date:** [December 16, 2018, 6:35pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/8 "2018-12-16T18:35:26Z")

</div>

> [@p12tic](#):
>
> Maybe we could translate Markdown to what’s supported by the Qt HTML renderer?

I think that could be a reasonable way to implement Markdown support.

If we’d pick Markdown though, we’d have to limit the supported features, since Markdown generally allows arbitrary HTML. I think bold/italic/strikethrough and different levels of headlines would be sufficient. (We probably don’t want to support things like inline-images and hyperlinks, right?)

---

<div class="post-metadata">

**Author:** ![EternityForest](https://yyz2.discourse-cdn.com/free1/user_avatar/librepcb.discourse.group/eternityforest/32/125_2.png) [@EternityForest](https://librepcb.discourse.group/u/EternityForest)\
**Post date:** [January 1, 2019, 6:16am UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/9 "2019-01-01T06:16:34Z")

</div>

I’d actually be in favor of hyperlink support, if it doesn’t cost anything to add. It might not be useful enough to bother adding, but it’s useful enough not to go out of your way to block.

Someone could use it to link to a license document, or the homepage of a product, etc. It Might not be “traditional schematic style”, but some may find it useful, and it’s no more of a security issue than any other hyperlink.

Some people might not like it if images could be loaded externally, they might think it’s a privacy problem, so images probably wouldn’t work.

Tables, however, could actually be useful for showing alternatively part values in different configurations.

---

<div class="post-metadata">

**Author:** ![ubruhin](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@ubruhin](https://librepcb.discourse.group/u/ubruhin)\
**Post date:** [January 1, 2019, 9:03pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/10 "2019-01-01T21:03:20Z")

</div>

Yes, I also think tables and hyperlinks would be quite useful.

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://librepcb.discourse.group/u/Doom)\
**Post date:** [October 7, 2019, 1:09pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/11 "2019-10-07T13:09:37Z")

</div>

As alternate pin function doesn’t exist for now, the schematic annotation functionality would be helpful.  
And after implementation of alternate pin, it will remains helpful for initial issue author’s reasons !

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://librepcb.discourse.group/u/Doom)\
**Post date:** [October 12, 2019, 10:19am UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/12 "2019-10-12T10:19:21Z")

</div>

I propose a workaround in the wait of the implementation  
here : [Workaround for Message Box in Schematic Editor](https://librepcb.discourse.group/t/workaround-for-message-box-in-schematic-editor/145)

---

<div class="post-metadata">

**Author:** ![ubruhin](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@ubruhin](https://librepcb.discourse.group/u/ubruhin)\
**Post date:** [November 16, 2020, 3:56pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/13 "2020-11-16T15:56:24Z")

</div>

I’d like to implement this feature soon. But to be honest, after thinking about this again, it feels like a nightmare to support any kind of formatting. Markup languages like HTML (converted from Markdown or not, doesn’t matter) are horrible to render in a graphics view, export to PDF etc. in a framework independent way. It _might_ be easy to support this at the moment with Qt and `QGraphicsView`. But what if we ever want to switch to a different rendering engine? IMHO it’s almost impossible to get the same rendering result with a different engine.

In addition, supporting hyperlinks could be quite complicated since then parts of a text item (not the whole text!) need to be clickable. If not supported out of the box by the rendering engine, this would be almost impossible to implement properly.

It seems that most of the other EDA tools do not support rich text as well. KiCad even doesn’t support TrueType fonts, you can only add very simple stroke texts to the schematic. Eagle (checked in v7.5.0) supports TrueType fonts, but no markup features at all (no italic, no bold, …). Altium seems to support configuring the the font, italic, bold etc. but only for the whole text.

In the end, I think the best way would be to copy the simple text labels from the symbol editor to the schematic editor, i.e. providing exactly the same functionality as in the symbol editor (no markup at all). If really needed, probably we could still add some more functionality to that text labels some day (italic, bold, color, …).

And if we ever want to support tables (I think sometimes they are useful indeed), I’d propose to add a new object type called “table” which simply consists of lines and text labels.

---

<div class="post-metadata">

**Author:** ![dbrgn](https://yyz2.discourse-cdn.com/free1/user_avatar/librepcb.discourse.group/dbrgn/32/25_2.png) [@dbrgn](https://librepcb.discourse.group/u/dbrgn)\
**Post date:** [November 16, 2020, 4:50pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/14 "2020-11-16T16:50:23Z")

</div>

> [@ubruhin](#):
>
> In the end, I think the best way would be to copy the simple text labels from the symbol editor to the schematic editor, i.e. providing exactly the same functionality as in the symbol editor (no markup at all). If really needed, probably we could still add some more functionality to that text labels some day (italic, bold, color, …).
> 
> And if we ever want to support tables (I think sometimes they are useful indeed), I’d propose to add a new object type called “table” which simply consists of lines and text labels.

That sounds like a good plan!

---

<div class="post-metadata">

**Author:** ![EdizonTN](https://yyz2.discourse-cdn.com/free1/user_avatar/librepcb.discourse.group/edizontn/32/222_2.png) [@EdizonTN](https://librepcb.discourse.group/u/EdizonTN)\
**Post date:** [November 17, 2020, 8:04pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/15 "2020-11-17T20:04:13Z")

</div>

> [@ubruhin](#):
>
> If really needed, probably we could still add some more functionality to that text labels some day (italic, bold, color, …).

Of course, It will be needs :-). Size, Color, Font, Alignment (H+V),… and possibility to add a placeholders value also.

But firstly, please, add a **simple** text element into the schematic.

---

<div class="post-metadata">

**Author:** ![ubruhin](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@ubruhin](https://librepcb.discourse.group/u/ubruhin)\
**Post date:** [November 17, 2020, 8:51pm UTC](https://librepcb.discourse.group/t/add-text-functionality-to-schematic-editor/19/16 "2020-11-17T20:51:22Z")

</div>

I created a PR with this feature:

> <https://github.com/LibrePCB/LibrePCB/pull/806>
>
> The same text labels as already supported in the symbol editor can now be added …to schematics as well:
> 
> !\[Peek 2020-11-17 19-29\](https://user-images.githubusercontent.com/5374821/99431813-9ec4aa80-290b-11eb-91e1-51d48a4b6a14.gif)
> 
> Fixes #441

> [@EdizonTN](#):
>
> Of course, It will be needs :-). Size, Color, Font, Alignment (H+V),… and possibility to add a placeholders value also.

Size, Alignment and placeholders are already implemented 🙂
