Using JSFL to change from one set of fonts to another (Flash 5) - flash-cs5

I am trying to change from using one set of fonts to another using JFSL. The problem I am having is that I can't get or set the style of font (shown in the image below)
http://i39.tinypic.com/20pbnsg.png
For family: ITC Kabel Std
style: Bold
textField.getTextAttr("face"), I get ITC Kabel Std Medium.
Is there anyway to do this with JFSL? If not, what alternatives do I have?

in flash, "bold" is most often a separate attribute form "face".
textField.setTextAttr("face","ITC Kabel Std")
textField.setTextAttr("bold",true)
it can be bold in flash but still the original font when evaluated.

Related

Sublime 3: can I change the font/size of comments?

Is there a way to make the comments a different (smaller) font from the rest of my code?
Although Sublime supports the idea that each view (editing pane) can have a unique list of settings, which includes font_face and font_size, it doesn't support multiple font faces or sizes from within a single view.
As such, it's not possible to have some elements use a different font face or size, although it's possible to change the font style to bold or italic, which is controlled by your color scheme.

How can I detect (and change) whether the font used in Charts in Excel and PowerPoint will follow the style or have been specified by a user?

When a chart is copied from Excel to PowerPoint, if the fonts on the Axis have been changed due to the style or theme applied in Excel, then they will normally change to be consistent with whichever theme is applied in PowerPoint (which is good). However, when the font (possibly formatting in general) has been overridden by a user, that the user specified font is the one used.
Writing code to detect what the default font is and apply it probably isn't that tricky, but I'd rather apply the theme font in a way that will match subsequent theme changes. Can anyone tell me how to do this?
I'm using C#, but am familiar with VBA and the object model is more or less identical in both, so approaches in either language should be fine.
After a little more digging, setting any font to a theme font looks like it can be accomplished by using the special font names comprised of:
+mj or +mn for heading or body fonts respectively
-lt, -ea, or -cs for latin, east asian, or complex script fonts respectively
So for my purposes, if I just assign all heading-like shapes' font properties to have font.name = "+mn-lt" then I accomplish what I need to, i.e. the font will match the theme and reflect subsequent theme changes.
NB that detecting whether this actually is already the case, since the font can be assigned either using the special font name or the actual font name, is a difficult problem (addressed elsewhere on SO). Thankfully, I don't have to worry too much about this...

How to create own bitmap font wiht image on LWUIT?

I use that code
Font bmpfont=Font.createBitmapFont(icon, new int[0], new int[12], "S");
First param is image, second is offset, third is length and fourth is charset. And I get Font object from that code. But I set that font to TextArea...
TextArea ta=new TextArea();
ta.getStlye().setFont(bmpfont);
ta.setText("S");
Text Area display only "S". Then I want to know how to create my own bitmap font and how to add that font to use. I want to make many bitmap fonts.
Generally we expect you to use the bitmap font creation tools within LWUIT and not invoke this method which is intended for internal use.
Regardless its plainly obvious you used the method incorrectly since the cut offsets don't contain the locations within the font.
Just use the resource editor or Ant task to create a font and then set that font either via the theme or by manually extracting it from the resource file.

Is there a program to create gifs out of text?

Is there any program that can convert a file into an animated gif by taking the bytes (whatever I see on an editor is seen) and producing them on frames? Im trying to change a large script I wrote into an image so that if I run it, it looks like as if the code is scrolling. I would use photoshop, if I knew how to use it. Even then, the code is really big, so I dont want to be doing it frame by frame.
Whatever you see on the editor screen is ... a screenfull, so why not a screen capture program like http://www.faststone.org/FSCaptureDetail.htm
However, I suspect that you want to convert the entire file to a gif, since you talk of scrolling. Is that so?
If so, be aware that animated GIFs are limited to 8 frames, so you might want to convert to another movie format.
You could, for instance, Google for "text to MPEG". If nothing does it directly, get something that adds subtitles & make your video a solid white background *or match your webpage).
Maybe simpler is something like this ...
A Scrolling Text Applet - Now Free. - Provide an animated look and feel to your web pages. Scrolling Text is a Java applet that will automatically size itself to the available area given to it by the HTML form via the WIDTH and HEIGHT properties of the APPLET tag. There are many configurable features of this applet including title, colors, font size and style, border width and color, graphics, background images etc.
Configurable parameters including;
Background Color - Define your desired background color
Title - If you want a stationary title then include this parameter
Font Size and Style - All text can have it's own Font size and style
Text Color - Specify the color of the text with this one
Border Width and Color - If you require a border then define it with these 2 parameters
Scroll Speed - Customise the Scroll Speed
Display Time - Vary the Display time of each page
This applet is easy to implement and configure and along with the example and help files you should have no trouble implementing your own customised Scrolling Text in your web pages. No understanding of java programming is required, everything is adjusted by parameters in the HTML tags.
Now FREE.
+1 for an interesting question.

Centering fonts in VB6

How do you determine the length of a string of text in Arial Bold font, and then center it in VB6?
We are not using a "label" or "picture box" to print the text to the screen. We are sizing the text on the fly, and allowing the user to scale the size of our application to their liking. We write the text to screen using code.
One way is to have a hidden picture box and setup the font specs of that picture box the way you want.
Then use the TextHeight and TextWidth methods of the PictureBox to take your measurements. The Units will be in whatever scalemode the Picture Box is set to.
If you are printing directly to the printer or form then just set your font FIRST then take your measurements.
To center it
MyText = "Hello World"
<displayarea>.FontName = "Arial"
<displayarea>.FontSize = 14
<displayarea>.FontBold = True
TextWidth = <displayarea>.TextWidth(MyText)
TextLeftCoordinate = <displayarea>.ScaleLeft+<displayarea>.ScaleWidth/2-TextWidth/2
<displayarea>.CurrentX = TextLeftCoordinate
<displayarea>.Print MyText
Substitute displayarea with whatever object you are using.
Based on your updated answer note that the hidden picture box suggestion isn't used to print. It is only get text measurement. However you are printing directly to the form so you just need to use the code example above.
I can't remember the specifics (it's been about 3 years since I last used VB 6), but there's a method on Form called something like "MeasureString". It takes the string, and measures it according to the font settings of the form.
Also, here's a comment posted by Jason Lepack in case I've misunderstood and over-complicated your requirements:
"Labels usually have an alignment property. If you set it to align to center then, regardless of the font face it should center in the label".
There are Win32 GDI functions you can invoke: see for example GetTextExtentPoint32 at http://msdn.microsoft.com/en-us/library/ms534223(VS.85).aspx
Your best option may be Form.TextWidth, which appears to return the width of a string in twips. I've just taken this approach in order to dynamically size a button based on the length of the label that needs to appear inside it.
There is also a corresponding function called Form.TextHeight which would allow you to do the same thing in the vertical dimension.
Make sure that you set the Font property of the form to match the Font property of the control you're intending to measure the text for, otherwise you'll get incorrect results.
Read more at http://msdn.microsoft.com/en-us/library/aa267168(VS.60).aspx

Resources