summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Steiner <jimmac@gmail.com>2008-09-12 22:56:23 +0200
committerJakub Steiner <jimmac@gmail.com>2008-09-12 22:56:23 +0200
commit6920a625ab34971485549530ffd87c18af087d26 (patch)
treece9b3943492bbd9f127cad5ed8d8a9176bee71dc
parent0728c9e3ab6b57713e062f5d09d2a99553c566f2 (diff)
parent069a09d6ef17741332f3aa289a26aa6b91e39223 (diff)
Merge branch 'master' of ssh://jimmac@git.freedesktop.org/git/tango/tango-icon-theme
-rw-r--r--Makefile.am12
-rw-r--r--render-bitmaps.pl.in28
2 files changed, 32 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index 20b38d9..c205f85 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,16 +5,17 @@ SUBDIRS = po svg
theme_in_files = index.theme.in.in
theme_DATA = $(theme_in_files:.theme.in.in=.theme)
-THEME_DIRS=$(shell SIZES="$(icon_sizes)"; for size in $$SIZES; do for dir in `find $$size/* -type d`; do printf "$$dir,"; done; done | sed -e "s/,$$//g")
+THEME_DIRS=$(shell SIZES="$(render_sizes)"; for size in $$SIZES; do for dir in `find $$size/* -type d`; do printf "$$dir,"; done; done | sed -e "s/,$$//g")
-%.theme.in: %.theme.in.in
- for size in $(icon_sizes); do \
+%.theme.in: %.theme.in.in Makefile
+ for size in $(render_sizes); do \
make -C svg $$size; \
done
dirs="$(THEME_DIRS)"; \
sed -e "s|\@THEME_DIRS\@|$$dirs|g" < $< > $@; \
for dir in `echo $$dirs | sed -e "s/,/ /g"`; do \
- size="`dirname $$dir`"; \
+ sizefull="`dirname $$dir`"; \
+ size="`echo $$sizefull | sed -e 's/x.*$$//g'`"; \
context="`basename $$dir`"; \
echo "[$$dir]" >> $@; \
echo "Size=$$size" >> $@; \
@@ -39,6 +40,9 @@ THEME_DIRS=$(shell SIZES="$(icon_sizes)"; for size in $$SIZES; do for dir in `fi
if test "$$context" = "emotes"; then \
echo "Context=Emotes" >> $@; \
fi; \
+ if test "$$context" = "intl"; then \
+ echo "Context=International" >> $@; \
+ fi; \
if test "$$context" = "mimetypes"; then \
echo "Context=MimeTypes" >> $@; \
fi; \
diff --git a/render-bitmaps.pl.in b/render-bitmaps.pl.in
index 5552c7f..17eaa75 100644
--- a/render-bitmaps.pl.in
+++ b/render-bitmaps.pl.in
@@ -27,16 +27,16 @@ GetOptions ("size|s=s" => \$sizeonly,
############################################################################
-use Data::Dumper;
+$outdir =~ s|[/]?$|/|g if ($outdir ne "");
sub render_icons {
my $filename = shift;
- my $mapping = XML::Simple::XMLin ($filename,
+ my $svgdata = XML::Simple::XMLin ($filename,
keyattr => [ qw() ],
forcearray => [ qw(g rect text) ]);
- foreach my $icon (@{$mapping->{g}}) {
+ foreach my $icon (@{$svgdata->{g}}) {
my $name;
my $context;
@@ -44,6 +44,16 @@ sub render_icons {
if (defined $plate->{'inkscape:label'} &&
$plate->{'inkscape:label'} =~ m/plate(.*)/) {
+ # Error out if the 'plate' layer is visible
+ # This is to prevent background squares from appearing
+ # inside the rendered PNG files
+ if (defined $plate->{style} &&
+ $plate->{style} ne "display:none") {
+ die "ERROR: $filename: Plate layer not hidden.\n";
+ }
+
+ # Get the icon's name and context so we can render it
+ # in the right location on disk
foreach my $text (@{$plate->{text}}) {
if (defined $text->{'inkscape:label'} &&
$text->{'inkscape:label'} eq "icon-name") {
@@ -53,17 +63,27 @@ sub render_icons {
$context = $text->{tspan}->{content};
}
}
+
+ # Grab the rectangle inside the plate and tell
+ # Inkscape to render the area to our PNG file
foreach my $box (@{$plate->{rect}}) {
if (defined $box->{'inkscape:label'}) {
my $size = $box->{'inkscape:label'};
- my $dir = "$outdir/$size/$context";
+ my $dir = "$outdir$size/$context";
+ # Skip this box if the size isn't the requested size
next if (defined $sizeonly && $size ne $sizeonly);
if (! -d $dir) {
system ("mkdir -p $dir");
}
+
+ # Only redirect STDOUT as STDERR is useful here
my $cmd = "$inkscape -i $box->{id} -e $dir/$name.png $filename > /dev/null";
+
+ # Print the context/name.png string to STDOUT
+ # We are doing this until a better cache method can
+ # be implemented, to avoid having to use redirection
print "$context/$name.png\n";
system ($cmd);
}