The code that generates SVG:
"<text x=\"" + (Width / 2) + "\" y=\"18\" width=\"30\" text-anchor=\"middle\" font-weight=\"Bold\" font-family=\"Simplex\" font-size=\"7\">" + "123" + "</text>"
The code is looped so it displays repeatedly
What's wrong with this text?
Conclusions:
centers the first digit
other elements start at the beginning of the element
When I remove the text-anchor, it changes a little but it still displays incorrectly
The problem is probably division by 2 (Width / 2)
You get a floating point value, which means that the separator is , instead of . in String Value
Use:
(Width / 2).ToString("0.00", CultureInfo.InvariantCulture)
I have a line of code:
Label11.Style["Height"] = (Label11.Height.Value + 15).ToString() + "px";
I populate the Label with text, each time I'm doing it I would like to increase the height of the Label by 15 px.
After the first populate it works fine (Height = 30), but after that it didn't change.
What am I doing wrong?
Finally, I managed to find the solution:
Label11.Height = new Unit((int)Label11.Height.Value + 15);
Windows "viewers" (like Windows Live Photo Gallery or Windows Photo Viewer) have not supported GIF animation since the days of Windows XP. The handiest way I know now to view animation of a GIF is to open it with MSIE -- but THAT, unlike Windows Photo Viewer, does not let me "scroll" through a directory to view other image files. It occurred to me that I could create a scripted HTML document that would perform that "scrolling" through the directory, but I don't know of a way to set it up so that by right-clicking an animated GIF file in my "Recent Items" (or elsewhere), and selecting "Open with...", that one of the options in that group would be the HTML doc I had created, to be opened in MSIE and given the name of the file I had right-clicked on (in the location.search property, for example), so that it would display THAT animated GIF initially, but then, by my script in the HMTL document, would let me scroll through the directory to view other image files as well. Also, I would want this option to be available for any type of image file, so that I could initially view, say, a JPEG file, but then subsequent "directory scrolling" could include GIFs or BMPs, etc. IS there a way to do that?
As the saying goes, "Don't get me started!" :)
I hadn't actually planned on having the batch write to the HTML file, but given that approach, I decided to put my javascript into a JS file, and have the batch write code that would reference it, thus:
#echo ^<html^>^<body onkeydown='kdn(event.keyCode)'^>^<span id='im'^>^<img style='display:none' src=%1^>^</span^>^<script src='c:/wind/misc/peruse.js'^>^</script^> > c:\wind\misc\peruse.htm
#start c:\wind\misc\peruse.htm
I found that the only way to handle the backslashes in %1 was to store it directly to an img src, as you did; however, I wanted more detailed code for the img than I wanted to write at this stage, so I set it to be invisible and placed it inside an id'd span for later elaboration by my script. It's nice to know about %~p1 but I don't really need it here.
And here is a rudimentary script (in peruse.js) for folder navigation that it calls up:
document.bgColor = 'black';
f = ('' + document.images[0].src).substr(8);
document.getElementById('im').innerHTML = '<table height=100% width=100% cellspacing=0 cellpadding=0><tr><td align="center" valign="middle"><img src="' + f + '" onMouseDown="self.focus()"></td></tr></table>';
fso = new ActiveXObject("Scripting.FileSystemObject");
d = fso.GetFolder(r = f.substr(0, (b = f.lastIndexOf('/')) + (b < 3)));
if(b > 2) r += '/';
b = (document.title = f.substr(++b)).toLowerCase();
for(n = new Enumerator(d.files) , s = [] , k = -1 , x = '..jpg.jpeg.gif.bmp.png.art.wmf.'; !n.atEnd(); n.moveNext()) {
if(x.indexOf((p = n.item().name).substr(p.lastIndexOf('.') + 512 & 511).toLowerCase() + '.') > 0) {
s[++k] = p.toLowerCase() + '*' + p
}
}
for(s.sort() , i = 0 , j = k++ , status = k + ' file' + (k > 1 ? 's' : '') , z = 100; (x = s[n = (i + j) >> 1].substr(0, s[n].indexOf('*'))) != b; ) {
x < b ? i = (i == n) + n : j = n
}
document.title = (n + 1) + ': ' + document.title;
function kdn(e, x) {
if(k > 1 && ((x = e % 63) == 37 || x == 39)) {
document.images[0].src = r + (x = s[n = (n + x - 38 + k) % k].substr(s[n].indexOf("*") + 1));
e = 12;
document.title = (n + 1) + ': ' + x;
setTimeout("status+=''", 150)
};
if(e == 12 || e == 101 || e == 107 || e == 109) {
document.images[0].style.zoom = (z = e < 107 ? 100 : e == 107 ? z * 1.2 : z / 1.2) + '%'
}
}
self.focus()
It sets the page background to black,
recovers the path-and-filename into f (with the problematical backslashes converted to forward slashes),
sets up table code so the image appears in the center of the window,
accesses the filesystemobject, and, with the path portion extracted from f into r,
sets the page title to just the filename (with the lowercase name stored to b),
and iterates the folder, checking for any image file,
creates an array s of all those files, with names in lowercase followed by their original case-format,
sorts the array case-blind, and binary-searches the array for the original file (as b) so it knows where to proceed from,
and prefixes the number-within-folder to the page title;
then the keydown function uses the left and right arrows to move backward and forward in the folder, with wraparound,
and uses the numpad+ and - to enlarge or shrink the image, and numpad-5 to reset the size (which also occurs for every new image).
It still remains, though, that I'd like to know of a way to simply pass the original %1 info to an HTML file, without writing a file in the process. I might expect it to be a way to have it "appended to the web address", as is done with info following a ? which gets placed in location.search. I don't know if the command line for iexplore.exe could have a parameter for passing info to location.search.
Being inspired by Is it possible to apply CSS to half of a character? I was wondering if something similar could be done with Indic text? As an example, in Sinhala ක + ා = කා (consonant + vowel). Is it possible to render the vowel stroke as a different colour from the base consonant? Other combinations:
ක + ෙ = කෙ
ක + ු = කු
ක + ො = කො
ක + ් = ක්
ම + ් = ම්
ම + ු = මු
ද + ා = දා
ක + ්ර = ක්ර
ර් + ක = ර්ක
ක + ්ය = ක්ය
ර් + ක + ්ර + ො = ර්ක්රො
I'm looking for an effect similar to this:
Thanks in advance for your awesome answers!
I've had a play with the code from the previous question and come up with this:
http://experimental.haujuseiit.com/vowelstroke.html
If you go to the link you'll see that some combinations don't work but most of them do. The other issue is when the vowel stroke is completely or partially before the consonant. I've had to set explicit widths for "e" (yellow) and "ee" (dark green) which will probably break with different fonts.
I'll post the source code when I've automated the solution.
Improvements anyone?
As far as I know it is not possible to apply a css style to half a character, but I bet you could fake it using two z-indexed graphics, or even glyphs, of differing color. Using one to mask the other.
That would work, but would be a huge amount of work.
ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, new Phrase(headerContent,headerFont) ,document.right() - 300, document.top() + 5, 0);
I have this line of code.For A4 papersize I get the header at the center of the page but for A3,A2,A1 I get it to the left of the page.What should I do so that I get it to the center of the page for all papersize(A4,A3,A2,A1).
You should use (document.left() + document.right()) / 2 for the x value.
As for the y value, you should use document.top() - (headerFont.getSize() * 1.5f). As far as I know document.top() + 5 results in adding text in the invisible area above the actual page.