diff options
Diffstat (limited to 'Master/texmf-dist/metapost/metauml/util_picture.mp')
-rw-r--r-- | Master/texmf-dist/metapost/metauml/util_picture.mp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/Master/texmf-dist/metapost/metauml/util_picture.mp b/Master/texmf-dist/metapost/metauml/util_picture.mp index b148f04857e..85ce68f7d41 100644 --- a/Master/texmf-dist/metapost/metauml/util_picture.mp +++ b/Master/texmf-dist/metapost/metauml/util_picture.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% Copyright (C) 2005 Ovidiu Gheorghies -% -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. -% -% This program is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with this program; if not, write to the Free Software -% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_picture_mp: expandafter endinput @@ -91,13 +77,15 @@ vardef PictureInfo@#(expr pleft, pright, ptop, pbottom)(text pfont)= %% var(numeric) fixedWidth, fixedHeight; - %% Controls how the contents of the picture is to be alligned relatively - %% to the picture margins. Can be one of "left", "centered", defaults to + %% Controls how the contents of the picture is to be aligned relatively + %% to the picture margins. Can be one of "left", "centered", and defaults to %% "left". The "centered" setting is useful for Picture-s whose fixedWidth %% is set to a given value. %% var(string) halign, valign; - + + var(string) textDecoration; + @#boxed := 0; @#borderColor := blue; @@ -108,7 +96,9 @@ vardef PictureInfo@#(expr pleft, pright, ptop, pbottom)(text pfont)= @#halign := "left"; @#valign := "bottom"; - + + @#textDecoration := "none"; + Margins.@#(pleft, pright, ptop, pbottom); FontInfoCopy.@#iFont(pfont); @@ -120,7 +110,8 @@ vardef PictureInfoCopy@#(text src)= @#boxed := src.boxed; @#borderColor := src.borderColor; @#ignoreNegativeBase := src.ignoreNegativeBase; - + @#textDecoration := src.textDecoration; + @#fixedWidth := src.fixedWidth; @#fixedHeight := src.fixedHeight; @@ -136,6 +127,7 @@ vardef PictureInfo_toString@#= enddef; PictureInfo.iPict(2, 2, 2, 2)(iFont); +PictureInfo.iPictNoMargins(0, 0, 0, 0)(iFont); PictureInfoCopy.iPictBoxed(iPict); iPictBoxed.boxed := 1; @@ -182,12 +174,12 @@ enddef; %% Lays out the Picture. %% vardef Picture_layout@# = - if @#layedout = 1: - log "Picture " & str @# & " already layed out."; + if @#laidout = 1: + log "Picture " & str @# & " already laid out."; else: log "Laying out " & (str @#); - @#layedout := 1; + @#laidout := 1; if known @#contentAsPicture: log "Content is known to be a picture"; @@ -225,7 +217,7 @@ vardef Picture_layout@# = elseif @#info.halign = "center": xdelta__ := (@#width-pictWidth(@#pict))/2; else: - 2 = 3; % throw exception illegal value for @#info.hallign + 2 = 3; % throw exception illegal value for @#info.halign fi; if @#info.valign = "bottom": @@ -233,7 +225,7 @@ vardef Picture_layout@# = elseif @#info.valign = "center": ydelta__ := (@#height-pictHeight(@#pict))/2 - @#negativeBase + negativeBaseAdjustement__; else: - 2 = 3; % throw exception illegal value for @#info.vallign + 2 = 3; % throw exception illegal value for @#info.valign fi; @#contentShift = @#sw + (xdelta__, ydelta__); @@ -249,6 +241,15 @@ vardef Picture_draw@# = draw @#pict shifted @#contentShift; + if (@#info.textDecoration = "underline"): + save ydelta, height; + height := pictHeight(@#pict) - @#negativeBase; + + ydelta := @#info.bottom - @#negativeBase - 0.8; + + draw @#sw + (@#info.left, ydelta) -- @#se + (-@#info.right, ydelta) withcolor black withpen pencircle scaled 0.2bp; + fi; + if (@#info.boxed = 1): draw objectBox(@#) withcolor @#info.borderColor; fi; |