Fixed Issue 265: Allow selection of a user-defined font in the text dialog

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@989 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2009-12-02 20:09:36 +00:00
parent c3fecc8bf9
commit 73f6b976a8
3 changed files with 28 additions and 11 deletions

View File

@ -402,6 +402,15 @@ span.zoom_tool {
background: #E8E8E8; background: #E8E8E8;
} }
#font_family_dropdown li {
font-size: 1.4em;
}
#font_family {
margin-left: 5px;
margin-right: 0;
}
#opacity_dropdown li { #opacity_dropdown li {
width: 140px; width: 140px;
} }

View File

@ -219,13 +219,19 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
<div id="text_panel"> <div id="text_panel">
<div class="tool_button" id="tool_bold" title="Bold Text [B]"><span></span>B</div> <div class="tool_button" id="tool_bold" title="Bold Text [B]"><span></span>B</div>
<div class="tool_button" id="tool_italic" title="Italic Text [I]"><span></span>i</div> <div class="tool_button" id="tool_italic" title="Italic Text [I]"><span></span>i</div>
<select id="font_family" class="text_tool" title="Change Font Family">
<option selected="selected" value="serif">serif</option> <input id="font_family" class="text_tool" type="text" title="Change Font Family" size="12"/>
<option value="sans-serif">sans-serif</option> <div id="font_family_dropdown" class="dropdown">
<option value="cursive">cursive</option> <button></button>
<option value="fantasy">fantasy</option> <ul>
<option value="monospace">monospace</option> <li style="font-family:serif">Serif</li>
</select> <li style="font-family:sans-serif">Sans-serif</li>
<li style="font-family:cursive">Cursive</li>
<li style="font-family:fantasy">Fantasy</li>
<li style="font-family:monospace">Monospace</li>
</ul>
</div>
<label id="font_sizeLabel" class="text_tool" for="font_size">size:</label> <label id="font_sizeLabel" class="text_tool" for="font_size">size:</label>
<input id="font_size" class="text_tool" title="Change Font Size" size="3" value="0" type="text"/> <input id="font_size" class="text_tool" title="Change Font Size" size="3" value="0" type="text"/>
<input id="text" class="text_tool" type="text" title="Change text contents" size="35"/> <input id="text" class="text_tool" type="text" title="Change text contents" size="35"/>

View File

@ -594,10 +594,6 @@ function svg_edit_setup() {
} }
}); });
$('#font_family').change(function(){
svgCanvas.setFontFamily(this.options[this.selectedIndex].value);
});
$('#seg_type').change(function() { $('#seg_type').change(function() {
svgCanvas.setSegType($(this).val()); svgCanvas.setSegType($(this).val());
}); });
@ -734,6 +730,12 @@ function svg_edit_setup() {
}); });
} }
addDropDown('#font_family_dropdown', function() {
var fam = $(this).text();
$('#font_family').val(fam);
svgCanvas.setFontFamily(fam);
});
addDropDown('#opacity_dropdown', function() { addDropDown('#opacity_dropdown', function() {
if($(this).find('div').length) return; if($(this).find('div').length) return;
var perc = parseInt($(this).text().split('%')[0]); var perc = parseInt($(this).text().split('%')[0]);