How can I change the text of svg - animation

I need help with a banner. How can I change the text if it is SVG. Here is the source [https://jsfiddle.net/1whr4xvj/][1] . Thanks

This one is a bit tricky. It looks like the "text" has been encoded as either a vector graphic or bitmap graphic and then base64 encoded. So for example, line 62 starts with:
this.shape_1.graphics.f("#293E40").s().p("...");
If you change that to
this.shape_1.graphics.f("#FF0000").s().p("...");
(i.e. change the color to red) then you can see that the "servicenow" text changes color. The p("...") part is a function that is being passed a base64-encoded string that represents the shape of the "s", "e", "r", "v", ... etc. in "servicenow".
I think the source you linked to may be minified javascript, so the function names are obscuring the original names. Could this library be easeljs perhaps?
If you want to change the text in this banner, unfortunately you'll need to figure out which base64 "data blob" corresponds with the text you want to change, and then replace it with a new "data blob" with your new lines/curves that can be interpreted as text.
Another approach could be to find the un-minified javascript, and then it would become easier to modify that--for example, by calling other easeljs functions (if that's what this library is) made for displaying text, rather than these data blobs as vector graphics.

Related

How to insert my 1:100 draw from Autocad into a Word document

I must to insert an 1:100 image I did in Autocad inside a Word document. I just printed in PDF format and it fits a A4. I could do a print screen, paste it on the Word page and crop the boundaries, but it need some very sketchy adjusts to put it back into the correct scale. Also the lines does not render very well. I believe there is a better and correct way to do.
I guess my first question would be, "Why do you need to insert the file into a word document?"
If you must insert it into a word document, you should use the Insert Object process described here -->PDF into Word Doc.
This would never be my preferred method though. I would rather convert the word document to PDF and then insert my scaled PDF drawing into the exported word doc PDF. This would keep the integrity of your drawing scale intact.
Just my two cents, which won't get you much.

macOS using html tags in nstextfield

Im wondering is there any ways to make this possible:
I have a nstextfield(or nstextview). And I also have one button, clicking on that should activate Bold mode for selected text, or the text that would written further.
First idea I had - is to use attributes for characters that would be written further, but this idea is not so good, as I would need to save that string in file later. I can save attributed string, but this gives me not proper format, what I would like to see is kind of or smth like that.
If I understand correctly your "First idea" is correct. Within your program you use NSAttributedString to add bold etc. your text. When you wish to save the text you can convert to HTML, or a number of other formats, and reading these formats and converting back to NSAttributed is also supported. A good place to start is Formatted Documents and Attributed Strings.

Convert string automatically to inline image

I'm using InDesign's data merge to generate playing cards for my game. Is it possible to convert a specific string to an inline image?
"You may roll :red_die: and add the rolled valued to this card's value"
For example the :red_die: in the text above would be automatically converted to an inline icon of a red coloured die.
No you can't this way. But you can place images with datamerge to the condition some fields of your source is set as an image one meaning having a "#" prefix. InDesign will process fields like #image as an image to place. It's up to you to add such a field in your source. However you can't nest it within another datamerge tag so it may not work eventually.
Other solution is using F/C dialog to replace :red_die: with clipboard content (your image) or to use scripting. You may also consider variable content plugin like EasyCatalog.

Rubyvis: subscripts/superscripts

I am considering using Rubyvis, a Ruby Port of the Protovis library, to generate plots for scientific publications. Rubyvis renders charts as SVG files. However, I haven't found a way to use subscripts or superscripts in text (such as diagram titles or axis labels).
The documentation for the Label class states:
The character data must be plain text (unicode), though the text can be styled
using the font property. If rich text is needed, external HTML elements can be
overlaid on the canvas by hand.
This sounds like the library itself does not support this functionality.
Is there a way to get subscripts and superscripts (and possible other rich text) directly in the output graphics file, when is is not embedded in a website?

export arabic text as images

I have a bunch of lines of Arabic text in UTF-8. The device I am trying to display this one does not support arabic text being displayed. Therefore, I need to convert the text into images.
I would like to save each line of text as an image with a specific width. I need to use a specific font as well. What is the best way to do this? Does anybody know of a tool that can be helpful here?
Problems I've run into so far:
PHP + GD: Arabic letters appear seperated and not in cursive as they should.
VB.net: I can dump each line of text into a richtextbox... but I don't know how to export the image of just that control.
Flash: no support for right to left text.
As for Arabic, you need a library to reverse chars/glyphs for PHP/GD. see e.g. http://sourceforge.net/projects/ar-php/ or at http://www.ar-php.org/.
Make sure your PHP file encoding is in unicode/UTF.
e.g. > open Notepad > Save As > encoding as UTF-8:
Sample usage for Arabic typography in PHP using imagettftext:
<?php
// The text to draw
require('./I18N/Arabic.php');
$Arabic = new I18N_Arabic('Glyphs');
$font = './DroidNaskh-Bold.ttf';
$text = $Arabic->utf8Glyphs('لغةٌ عربيّة');
// Create the image
$im = imagecreatetruecolor(600, 300);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 599, 299, $white);
// Add the text
imagettftext($im, 50, 0, 90, 90, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im, "./output_arabic_image.png");
echo 'open: ./output_arabic_image.png';
imagedestroy($im);
?>
Outputs:
I've heard that pango handles Arabic layout pretty well. haven't used it though.
Update:
The utility pango-view can render text in any language and output it as an image
$ pango-view input_file.txt --no-display --output=image.png
or you can supply the text as an option as well:
$ pango-view --no-display --output=image.png --text="your sentence"
You can also specify a width:
--width=50 -wrap=word
<< end of update
Alternatively, there are a few programs that use unicode characters that represent contextual Arabic letter forms and process text and make it render properly on systems that can't render Arabic text properly.
Here are the ones I know of:
The Free Ressam, written in python, by me ^_^
Tadween, written in C#,
Arabic writer, written in javascript
They're all open source, so even if you don't use any of these languages, you can study the code and create a solution in your programming language of choice.
There are many ways; using Windows.Forms for example, I think you:
Create an empty Image instance; I think that at this point you define the image's dimensions
Create a Graphics instance from the Image, using the Graphics.FromImage method
Invoke the method of the Control (the RichTextBox) which tells it to paint itself: and to that method, pass the Graphics instance associated with your image, so that it paints itself onto the image.
I am not sure if you still waiting for an answer but there is very clean and neat solution for your problem. You can change any text, including rtl, to image based on their css class. But let me tell you first, PHP and GD what ever, doesn't do any good for rtl text. You should try asp.net text replacement based on width.
Once I walked the same path and struggled for days. Here is what you should do.
First go to following address and see the tutorial and download the files.
http://weblogs.asp.net/yaneshtyagi/archive/2008/11/07/text-to-image-convertor.aspx
Second you need an asp.net server. You can install it or you can use one of those virtual server, such as mono asp.net server, or you can use visual web developer.
The code you will get converts the text into a single line image, though you can specify width. In that case long line of text shrink and becomes illegible. What you need is to text wrap based on specified width.
Here in this link that explains how to alter the code in fontwriter.ashx to achieve text wrap. http://www.codeproject.com/Questions/189513/Dynamic-Image-Replacement-Method-with-Csharp.aspx
Third run the your page via asp.net server. Once you have the images you can save it, right click and save as, with firefox, firefox works best so far.
Now, all the text is converted into images and original text will be added to image as alt tag. Hope it helps.
I am planning to post a tutorial on the issue soon. Check www.codeproject.com later.

Resources