cdelker / schemdraw

MIT License
103 stars 20 forks source link

fix(ElementCompound): font fix when using Drawing.config font #16

Closed lucaskatayama closed 10 months ago

lucaskatayama commented 10 months ago

Problem

Using Drawing.config to set config doesn't apply to ElementCompound.

e.g.

import schemdraw
import schemdraw.elements as elm

class Test(elm.compound.ElementCompound):
    def __init__(self, *d, **kwargs):
        super().__init__(*d, **kwargs)
        self.add(elm.Resistor().label('10R'))

with schemdraw.Drawing() as d:
    d.config(font='Arial')
    d += Test()
image

Expect

image
lucaskatayama commented 10 months ago

Opened a PR #17

kzhk75 commented 5 months ago

If we want to change fonts in latex mode , like $R$, how can we do? In Schemdraw, mathfont seems one choice, but I can not set as schemdraw.config(lw=1, mathfont='cmb10').

cdelker commented 4 months ago

It's not documented, but you can pass mathfont to schemdraw.Drawing(mathfont=...). It can be added to config to be consistent. If that doesn't work for you, please open a new issue.

kzhk75 commented 4 months ago

Thanks. schemdraw.Drawing(mathfont='cm') works well, but schemdraw.config(...) can NOT receive mathfont='cm'. so, I opened https://github.com/cdelker/schemdraw/issues/33