[LON-CAPA-cvs] cvs: modules /damieng/graphical_editor/loncapa_daxe/web/config loncapa.xsd loncom/homework drawimage.pm randomlylabel.pm
raeburn
raeburn at source.lon-capa.org
Thu Apr 4 22:31:23 EDT 2024
raeburn Fri Apr 5 02:31:23 2024 EDT
Modified files:
/loncom/homework randomlylabel.pm drawimage.pm
/modules/damieng/graphical_editor/loncapa_daxe/web/config
loncapa.xsd
Log:
- Add rotation attribute to text tag for drawimage. Rotation value is the
number of degrees to rotate the text, relative to the horizontal.
- Only used if font attribute is set to freetype font (e.g., helvetica 12).
- If set to a valid value will override the value for direction attribute.
Index: loncom/homework/randomlylabel.pm
diff -u loncom/homework/randomlylabel.pm:1.33 loncom/homework/randomlylabel.pm:1.34
--- loncom/homework/randomlylabel.pm:1.33 Thu Apr 4 17:33:01 2024
+++ loncom/homework/randomlylabel.pm Fri Apr 5 02:31:23 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# randomlabel.png: composite together text and images into 1 image
#
-# $Id: randomlylabel.pm,v 1.33 2024/04/04 17:33:01 raeburn Exp $
+# $Id: randomlylabel.pm,v 1.34 2024/04/05 02:31:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -129,7 +129,7 @@
=item LABEL
-x:y:text:font:color:direction
+x:y:text:font:color:direction:rotation
=over 4
@@ -420,7 +420,7 @@
$image->copyResized($subimage,$x,$y,$srcX,$srcY,$destW,$destH,
$srcW,$srcH);
} elsif ($type eq 'LABEL') {
- my ($x,$y,$text,$font,$color,$direction)=
+ my ($x,$y,$text,$font,$color,$direction,$rotation)=
split(':',$env{$prefix."OBJ$i"});
$text=&unescape($text);
my $imcolor=&get_color_from_hexstring($image,$color);
@@ -451,7 +451,9 @@
} elsif ($type eq 'ttf') {
my ($fontname,$ptsize)=split(/\s+/,$font);
my $angle = 0;
- if ($direction eq 'vertical') {
+ if ($rotation =~ /^(\-|\+|)\d+(|\.\d*)$/) {
+ $angle = Math::Trig::deg2rad($rotation);
+ } elsif ($direction eq 'vertical') {
$angle = Math::Trig::deg2rad(90);
} elsif ($direction eq 'horizontal') {
$angle = 0;
Index: loncom/homework/drawimage.pm
diff -u loncom/homework/drawimage.pm:1.10 loncom/homework/drawimage.pm:1.11
--- loncom/homework/drawimage.pm:1.10 Wed Mar 12 02:46:52 2008
+++ loncom/homework/drawimage.pm Fri Apr 5 02:31:23 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# programatic image drawing
#
-# $Id: drawimage.pm,v 1.10 2008/03/12 02:46:52 raeburn Exp $
+# $Id: drawimage.pm,v 1.11 2024/04/05 02:31:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -98,11 +98,12 @@
my $font = &Apache::lonxml::get_param('font',$parstack,$safeeval);
my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);
my $direction = &Apache::lonxml::get_param('direction',$parstack,$safeeval);
+ my $rotation = &Apache::lonxml::get_param('rotation',$parstack,$safeeval);
my $text = &Apache::lonxml::endredirection();
$text = &escape($text);
$args{"cgi.$cgi_id.OBJTYPE"}.='LABEL:';
my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
- $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$text,$font,$color,$direction));
+ $args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$text,$font,$color,$direction,$rotation));
}
return $result;
}
Index: modules/damieng/graphical_editor/loncapa_daxe/web/config/loncapa.xsd
diff -u modules/damieng/graphical_editor/loncapa_daxe/web/config/loncapa.xsd:1.27 modules/damieng/graphical_editor/loncapa_daxe/web/config/loncapa.xsd:1.28
--- modules/damieng/graphical_editor/loncapa_daxe/web/config/loncapa.xsd:1.27 Thu Feb 16 19:12:29 2017
+++ modules/damieng/graphical_editor/loncapa_daxe/web/config/loncapa.xsd Fri Apr 5 02:31:23 2024
@@ -5274,6 +5274,7 @@
<xs:attribute name="font" type="xs:string"/>
<xs:attribute name="color" type="xs:string"/>
<xs:attribute name="direction" type="xs:string"/>
+ <xs:attribute name="rotation" type="decimal-or-perl"/>
</xs:complexType>
</xs:element>
<xs:element name="line">
@@ -8147,4 +8148,4 @@
</xs:complexType>
</xs:element>
-</xs:schema>
\ No newline at end of file
+</xs:schema>
More information about the LON-CAPA-cvs
mailing list