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.
Related
I want to display text with directwrite in a specified rectangle and with a specified font size, the text outside the rect should be cutted off.
By searching I found something about CreateTextLayout but it looked like it isn't possible to define the font size with it.
Thanks for answers.
It's not something DirectWrite is responsible for, unless you're using IDWriteBitmapRenderTarget. If you're using DrawText/DrawTextLayout from Direct2D you simply need to use D2D1_DRAW_TEXT_OPTIONS_CLIP option. If you are using DirectWrite bitmap target, it's enough to set target size to layout size, or to blit layout size portion to your destination context.
There is IDWriteTextFormat::SetTrimming(). When applied (with SetTrimming(&DWRITE_TRIMMING{DWRITE_TRIMMING_GRANULARITY_CHARACTER,0,0}, nullptr);), overflowing characters [glyph clusters?] and lines are omitted.
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...
I want bitmap font for Form from LWUIT component. I create rs file with bitmap font(that is theme file create by Resource Editor.jar). Then I load that file from my MIDlet with following code...
Then I get Font by, get method("Font 1"); // Font 1 is font name create with LWUIT Editor.
But when i want font from Font object(that from Resource Object) from following code..
Then i get character set from font is ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:!/*()[]{}|#$%^&<>?'"+- "
What's the problem is that? I change many font type but all are return that String.
The string you are listing above is the charset string which indicates the characters supported by the font it is not the font itself. To apply the font use the setFont method of the Graphics or Style classes.
Is there any way to set the size(means font size,i want to make my text larger contaning font size of 17-20) of the text in the label in LWUIT for J2ME.
You can set the large text by two ways.
Use ResourceEdit and Create the new Large Font in Font tab. Then change the Label#Unselected font to that new Large Font.
Use following code,
new Label("Sample").getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE));
For more info see this article, Using Font with LWUIT
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.