Text alignment inside input controls

This commit is contained in:
notmasteryet 2011-11-02 22:00:33 -05:00
parent f3ee85efab
commit 3d36a05d7f
2 changed files with 13 additions and 1 deletions

View File

@ -340,6 +340,7 @@ var Page = (function pagePage() {
var m = /([\d\.]+)\sTf/.exec(da);
if (m)
item.fontSize = parseFloat(m[1]);
item.textAlignment = annotation.get('Q');
item.flags = annotation.get('Ff') || 0;
break;
}

View File

@ -398,7 +398,18 @@ var PageView = function pageView(container, content, id, pageWidth, pageHeight,
function assignFontStyle(element, item) {
var fontStyles = '';
if ('fontSize' in item)
fontStyles += 'font-size: ' + Math.round(item.fontSize * scale) + 'px';
fontStyles += 'font-size: ' + Math.round(item.fontSize * scale) + 'px;';
switch (item.textAlignment) {
case 0:
fontStyles += 'text-align: left;';
break;
case 1:
fontStyles += 'text-align: center;';
break;
case 2:
fontStyles += 'text-align: right;';
break;
}
element.setAttribute('style', element.getAttribute('style') + fontStyles);
}