|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# render_loadConfig.sh -- This function defines CentOS brands
|
|
|
4c79b5 |
# pre-rendering configuration script. This function is used to produce
|
|
|
4c79b5 |
# CentOS brands translation files.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# The rendering process used to produce CentOS Brands translation
|
|
|
4c79b5 |
# files is a bit different to that commonly found in other artwork
|
|
|
4c79b5 |
# components inside CentOS Artwork Repository. Relevant differences
|
|
|
4c79b5 |
# are described below:
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# 1) Translation files are not regular files, but symbolic links
|
|
|
4c79b5 |
# pointing to the common template translation structure, inside the
|
|
|
4c79b5 |
# translation template (`Tpl') directory.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# 2) Translation files are created using design templates as
|
|
|
4c79b5 |
# reference. This script creates a translation structure where the
|
|
|
4c79b5 |
# translation template (`Tpl') directory structure applies to each
|
|
|
4c79b5 |
# single design template available.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# For instance, if the translation template (`Tpl') directory
|
|
|
4c79b5 |
# structure has 30 translation files and there are 20 design
|
|
|
4c79b5 |
# templates, this script creates a translation structure of symbolic
|
|
|
4c79b5 |
# links where the 30 translation files apply the 20 design templates
|
|
|
4c79b5 |
# one by one, producing 600 images as result ---without counting
|
|
|
4c79b5 |
# possible formats convenction that may happen during the
|
|
|
4c79b5 |
# post-rendering actions---.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Translation file names inside translation template (`Tpl') directory
|
|
|
4c79b5 |
# have special meaning:
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# 1) Conventional file name (i.e. `blue.sed', `2c-a.sed', etc.): In
|
|
|
4c79b5 |
# this case, replacements inside translation file are applied to
|
|
|
4c79b5 |
# design template and the translation file name is used as final
|
|
|
4c79b5 |
# image name. The final image is saved with same dimensions that its
|
|
|
4c79b5 |
# design template has.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# 2) Numeric file name only (i.e. `300.sed', `200.sed', etc.): In
|
|
|
4c79b5 |
# this case, replacements inside translation files are applied to the
|
|
|
4c79b5 |
# design template, and the translation file name is used as final
|
|
|
4c79b5 |
# image name. The final image is saved using an specific `width'
|
|
|
4c79b5 |
# defined by the number part of the translation file name. The image
|
|
|
4c79b5 |
# `height' is automatically scaled based on the previous `width'
|
|
|
4c79b5 |
# definition to maintain the design template proportions.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# For instance, if your design template has 400x200 pixels of
|
|
|
4c79b5 |
# dimension, and you apply a translation file named `300.sed' to it,
|
|
|
4c79b5 |
# the final image you get as result will have 300x100 pixels of
|
|
|
4c79b5 |
# dimension.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# The same is true if you use higher numbers like `1024.sed',
|
|
|
4c79b5 |
# `2048.sed', etc. In these cases you have bigger images
|
|
|
4c79b5 |
# proportionally.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# As we are using scalable vectorial graphics as source, image size
|
|
|
4c79b5 |
# definition starts to be a problem on very small generated images.
|
|
|
4c79b5 |
# Bigger images have better definition. As it is bigger, more is the
|
|
|
4c79b5 |
# image definition you have. But take care, too much definition for
|
|
|
4c79b5 |
# an image that was not designed for such a big dimension can result
|
|
|
4c79b5 |
# in something that looks different from what you expect. Just try,
|
|
|
4c79b5 |
# look, and decide by yourself.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Generally, translation files inside translation template (`Tpl')
|
|
|
4c79b5 |
# directory structure contain color replacements only. The color used
|
|
|
4c79b5 |
# as replacement pattern is black (#000000).
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Using CentOS Brand translation files rendering script, CentOS Brand
|
|
|
4c79b5 |
# designers can work freely and use this script to generate the
|
|
|
4c79b5 |
# translation files that renderImage needs, in order to produce CentOS
|
|
|
4c79b5 |
# Brand images in different dimensions and colors.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Copyright (C) 2009-2010 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is free software; you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
4c79b5 |
# (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
# $Id: render.conf.sh 98 2010-09-19 16:01:53Z al $
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function render_loadConfig {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define variables as local to avoid conflits in the function
|
|
|
4c79b5 |
# outside.
|
|
|
4c79b5 |
local FILE=''
|
|
|
4c79b5 |
local TRANSLATION=''
|
|
|
4c79b5 |
local BOND=''
|
|
|
4c79b5 |
local DIRNAME=''
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define absolute path holding CentOS Brand design templates.
|
|
|
4c79b5 |
local SVG=/home/centos/artwork/trunk/Identity/Brands/Tpl
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define absolute path holding CentOS Brand translations files.
|
|
|
4c79b5 |
local TXT=/home/centos/artwork/trunk/Translations/Identity/Brands
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define bond path. Remove template (`./Tpl/') directory and
|
|
|
4c79b5 |
# `.svg' extension from design template (`Tpl') structure.
|
|
|
4c79b5 |
local BONDS=$(find $SVG -name '*.svg' \
|
|
|
4c79b5 |
| sed -e "s!$SVG/!!" -e 's!\.svg$!!' | sort )
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for BOND in $BONDS;do
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Look inside CentOS Brand translation template (`Tpl') directory
|
|
|
4c79b5 |
# and remove the `Tpl/' string from path to produce the final
|
|
|
4c79b5 |
# translation structure, relatively to the current location.
|
|
|
4c79b5 |
# If the third argument has the form --filter=regex then you
|
|
|
4c79b5 |
# can reduce the amount of translation templates to process
|
|
|
4c79b5 |
# using the string regex as pattern.
|
|
|
4c79b5 |
for FILE in $(find $TXT/Tpl -regextype posix-egrep \
|
|
|
4c79b5 |
-regex "^.+/$REGEX\.sed$" | sort );do
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define translation path.
|
|
|
4c79b5 |
TRANSLATION=$FILE
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Re-define file path.
|
|
|
4c79b5 |
FILE=$(echo $FILE | sed -r 's!^.+/Tpl/!!')
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check output directory existence.
|
|
|
4c79b5 |
DIRNAME=$(dirname $OPTIONVAL/$BOND/$FILE)
|
|
|
4c79b5 |
if [ ! -d $DIRNAME ]; then
|
|
|
4c79b5 |
mkdir -p $DIRNAME
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Create final translation structure. Brands' translation
|
|
|
4c79b5 |
# files are always the same, in contrats with commonly
|
|
|
4c79b5 |
# used translation files, there is no releases involved.
|
|
|
4c79b5 |
# This let us reuse translation files using symbolic links
|
|
|
4c79b5 |
# and pointing them to translation template (`Tpl') files.
|
|
|
4c79b5 |
cli_printMessage $TRANSLATION "AsTranslationLine"
|
|
|
4c79b5 |
cli_printMessage $OPTIONVAL/$BOND/$FILE "AsLinkToLine"
|
|
|
4c79b5 |
ln -sf $TRANSLATION $OPTIONVAL/$BOND/$FILE
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '------------------------------------------------------------'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
done
|
|
|
4c79b5 |
|
|
|
4c79b5 |
done \
|
|
|
f3bce7 |
| awk -f /home/centos/artwork/trunk/Scripts/Bash/Style/output_forRendering.awk
|
|
|
4c79b5 |
}
|