Update symbol library.

* Workaround the Windows pangocairo bug by drawing text
  with curves. Remove some of the meters.
* Remove terminal lines from meters and voltage sources,
  add vertical terminal points instead.
This commit is contained in:
Přemysl Eric Janouch 2011-02-24 08:14:48 +01:00
parent 8cdefbca29
commit bd1b3adf56
2 changed files with 21 additions and 58 deletions

View File

@ -5,79 +5,48 @@ local names_A =
cs = "Ampérmetr" cs = "Ampérmetr"
} }
local names_mA =
{
en = "Milliammeter",
cs = "Miliampérmetr"
}
local names_V = local names_V =
{ {
en = "Voltmeter", en = "Voltmeter",
cs = "Voltmetr" cs = "Voltmetr"
} }
local names_ohm =
{
en = "Ohmmeter",
cs = "Ohmmetr"
}
local names_W =
{
en = "Wattmeter",
cs = "Wattmetr"
}
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
local area = {-3, -2, 3, 2} local area = {-2, -2, 2, 2}
-- Terminal points -- Terminal points
local terminals = {{-3, 0}, {3, 0}} local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
-- Rendering -- Rendering
local render = function (cr, name) local render_A = function (cr)
-- The circle -- The circle
cr.arc (0, 0, 2, 0, math.pi * 2) cr.arc (0, 0, 2, 0, math.pi * 2)
-- The contact -- The letter A
cr.move_to (-3, 0) cr.move_to (-0.4, 0.5)
cr.line_to (-2, 0) cr.line_to (0, -0.5)
cr.line_to (0.4, 0.5)
cr.move_to (2, 0) cr.move_to (-0.3, 0.25)
cr.line_to (3, 0) cr.line_to (0.3, 0.25)
cr.stroke () cr.stroke ()
cr.move_to (0, 0)
cr.show_text (name)
end
local render_A = function (cr)
render (cr, "A")
end
local render_mA = function (cr)
render (cr, "mA")
end end
local render_V = function (cr) local render_V = function (cr)
render (cr, "V") -- The circle
end cr.arc (0, 0, 2, 0, math.pi * 2)
local render_ohm = function (cr) -- The letter V
render (cr, "") cr.move_to (-0.4, -0.5)
end cr.line_to (0, 0.5)
cr.line_to (0.4, -0.5)
local render_W = function (cr) cr.stroke ()
render (cr, "W")
end end
-- Register the symbols -- Register the symbols
logdiag.register ("Ammeter", names_A, area, terminals, render_A) logdiag.register ("Ammeter", names_A, area, terminals, render_A)
logdiag.register ("Milliammeter", names_mA, area, terminals, render_mA)
logdiag.register ("Voltmeter", names_V, area, terminals, render_V) logdiag.register ("Voltmeter", names_V, area, terminals, render_V)
logdiag.register ("Ohmmeter", names_ohm, area, terminals, render_ohm)
logdiag.register ("Wattmeter", names_W, area, terminals, render_W)

View File

@ -12,23 +12,17 @@ local names_dc =
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
local area = {-3, -2, 3, 2} local area_ac = {-2, -2, 2, 2}
local area_dc = {-2, -2, 3, 2}
-- Terminal points -- Terminal points
local terminals = {{-3, 0}, {3, 0}} local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
-- Rendering -- Rendering
local render = function (cr) local render = function (cr)
-- The circle -- The circle
cr.arc (0, 0, 2, 0, math.pi * 2) cr.arc (0, 0, 2, 0, math.pi * 2)
-- The terminals
cr.move_to (-3, 0)
cr.line_to (-2, 0)
cr.move_to (2, 0)
cr.line_to (3, 0)
cr.stroke () cr.stroke ()
end end
@ -66,7 +60,7 @@ local render_dc = function (cr)
end end
-- Register the symbol -- Register the symbol
logdiag.register ("ACSource", names_ac, area, terminals, render_ac) logdiag.register ("ACSource", names_ac, area_ac, terminals, render_ac)
logdiag.register ("DCSource", names_dc, area, terminals, render_dc) logdiag.register ("DCSource", names_dc, area_dc, terminals, render_dc)