<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>lejnieks &#187; CSS</title>
	<atom:link href="http://www.lejnieks.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lejnieks.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Jan 2010 19:22:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Externalizing CSS Text for Designer</title>
		<link>http://www.lejnieks.com/2008/03/29/externalizing-css-text-for-designer/</link>
		<comments>http://www.lejnieks.com/2008/03/29/externalizing-css-text-for-designer/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 17:18:18 +0000</pubDate>
		<dc:creator>klejnieks</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Skinning]]></category>

		<guid isPermaLink="false">http://lejnieks.com/?p=10</guid>
		<description><![CDATA[Heres a quick and easy way to separate font styles from component styles which will allow ux teams to skin fonts independent of the development team or even independent of the encapsulating component itself. This all came up from a project im involved with right now requires a high regard to pixel perfect design, which [...]]]></description>
			<content:encoded><![CDATA[<p>Heres a quick and easy way to separate font styles from component styles which will allow ux teams to skin fonts independent of the development team or even independent of the encapsulating component itself. This all came up from a project im involved with right now requires a high regard to pixel perfect design, which meant a lot of back and forth between the ux team. Font rendering was clearly something that needed some direct tweaking from the ux guys. while I do think i have a pretty good eye for design, they are ultimately the ones who will sign off of subpixel  font grid type fitting and so on. So now my goal was to separate as much of the text formatting from the components and hopefully normalize it as best as possible as well.</p>
<p><span id="more-10"></span></p>
<p>The separation and normalization went pretty well and reduced my css doc by about 1200 lines, however there were still elements of font control that i could not external, mostly in components like buttons. I didnt want to have the redundancy and overhead of</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">CustomButton
<span style="color: #66cc66;">&#123;</span>
	font-family : 	<span style="color: #ff0000;">&quot;Myriad Pro Bold&quot;</span>;
	font-weight :	normal;
	font-style : 	normal;
	font-<span style="color: #0066CC;">size</span> :	<span style="color: #cc66cc;">11</span>;
	font-sharpness : 	<span style="color: #cc66cc;">0</span>;
	font-thickness : 	<span style="color: #cc66cc;">0</span>;
	letter-spacing :	.1;
	font-anti-alias-<span style="color: #0066CC;">type</span> :	advanced;
	font-grid-fit-<span style="color: #0066CC;">type</span> :	subpixel;
	text-<span style="color: #0066CC;">align</span> :	center;
	<span style="color: #0066CC;">color</span> :	<span style="color: #808080; font-style: italic;">#ff3300;</span>
	textRollOverColor :	<span style="color: #808080; font-style: italic;">#ffffff;</span>
	textSelectedColor :	<span style="color: #808080; font-style: italic;">#CC0000;</span>
	fillAlphas : <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>;
	fillColors : <span style="color: #808080; font-style: italic;">#ffffff, #ffffff, #0099cc, #0099cc;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>I was looking for a way to separate the design from the code in my styles similar to how the datagrid has references to text css</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>mx:DataGrid headerStyleName=<span style="color: #ff0000;">&quot;customHeaderStyleName&quot;</span></pre></td></tr></table></div>

<p>so I looked around for a way to pull the text styles out of different components so the ux group can easily styles the different fonts in the application without having to worry about the actual component. After looking around I discovered most components can override the textStyle or similar such as</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CustomButton <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">Button</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> CustomButton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	override protected <span style="color: #000000; font-weight: bold;">function</span> commitProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> textFieldStyleName:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">getStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;buttonLabelStyleName&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">styleName</span> = textFieldStyleName;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>this works exactly as i had hoped, now the ux group can set fonts independent of the components and spend the needed time exacting their fonts.</p>
<p>You can see a sample below, side click for the source.<br />
<object type="application/x-shockwave-flash" data="http://projects.lejnieks.com/Sample_externalized_css_textStyle/SampleCSSTextStyle.swf" width="425" height="355" class="embedflash"><param name="movie" value="http://projects.lejnieks.com/Sample_externalized_css_textStyle/SampleCSSTextStyle.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lejnieks.com/2008/03/29/externalizing-css-text-for-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
