2010-01-18 49 views
1

我在Windows 7中编写了一个补充工具栏小工具,并添加了g:textObject,稍后通过variable.value更改了该值。Windows小工具字体错误

但是,在Windows Vista中运行时,文本似乎会奇怪地压缩自己。

这段代码有什么问题吗?

var clock = document.getElementById("background").addTextObject("Time", "Nyala", 18, "white", 110, 500); 
//This correctly displays the word 'Time' in the proper font. 

clock.value = clock.value+"s"; 
//This causes the text to become "Times" but shrink. 
//appending more sporadically causes the textObject to shrink as well. 

正在使用.value错误的方式来做到这一点?

回答

1

更改文本字符串不会更新g:文本对象的宽度或高度。这是一个已知的问题,为了兼容性目的可能不会被修复。您必须手动重置宽度和高度更改值:

var clock = document.getElementById("background") 
    .addTextObject("Time", "Nyala", 18, "white", 110, 500); 

// Set the new value and reset the width and height by setting them to 0 
clock.value = clock.value+"s"; 
clock.width = 0; 
clock.height = 0; 
+0

谢谢,我会试试看!顺便说一句,这是所有这些记录在任何地方?我无法让谷歌指向我在msdn中的正确位置,我认为它应该是.. – Vanwaril 2010-01-19 16:41:36

+1

许多错误以及适用的各自的解决方法可以在http://www.aeroxp.org找到。 /board/index.php?showtopic=7318。不过,这个清单还没有更新。我认为,从我自己的测试中,大约18个这些错误在Windows 7中得到修复。 – 2010-01-19 17:23:16