Actionscript 3 :: Get Accurate Character/font Metrics?
Jan 12, 2012
I have created a class which will use an embedded font to dynamically generate a bitmap font at run-time. So far it works well except that I have a minor issue with character spacing.
In the image below the first line is an actual TextField and the second has been rendered using the generated bitmap font.
If you look at the word 'fox' or the 'ed' of the word 'jumped' you can see that the letter spacing looks a little bit odd.
Are there any alternatives to the TextLineMetrics class which will give me more accurate character metrics?
UPDATE :
Text rendering quality using the new Flash Text Engine :
UPDATE 2 :
By chance I have eventually found the solution :
The first problem was the antiAliasType property which was set to AntiAliasType.ADVANCED. Although it produces higher quality text it also causes TextLineMetrics to return incorrect widths for characters.
The second was that it had to also be rounded up (using Math.ceil) to the nearest pixel and not down.
View 1 Replies
Similar Posts:
Mar 23, 2011
In my application I'm using a custom embedded font for English (Helvetica New) which does not contain characters (glyphs) for chinese unicode range. In the application, wherver chinese characters are avaiable they are not displayed (suppressed) since they are missing in the custom embedded font. How can I make the flash player to use a fallback system font for the missing characters? And the fallback should be for the missing characters alone. For the Engligh characters it should use the embedded font.
View 1 Replies
Feb 21, 2010
When the files are downloaded to your computer there are several file folders included. Some are for pictures and there is HTML as well as the SWF files and the INDEX. In very short order I determined that you could simply replace there pictures with your pictures and even change the text on the buttons as well as the body of the site. It seemed very painless. We are now down to just one issue that I cannot figure out. On the main page there is a place on the page for the company name. I went into the HTML and changed that which worked fine.
My issue is that she already has a predefined font for her company. It is Trajan Pro. I cannot find anything in the HTML that has to do with the font.However there is a folder included in the download which is entitled "fonts". Within that folder is the various fonts used in the website. how I can change the font that is being used?
PS -- There is a folder full of Photoshop images which are basically the pages of the site. They have many layers. I tried to change the company name and font in Photoshop but it had no affect.
View 3 Replies
Jul 10, 2011
I have a text field (old-style, non-TLF) with the following HTML text:[code].....
The font Optima is embedded, and I've selected embed all glyphs.What I'm getting rendered to the screen is as the image below, with a random i + umlaut character in place of the bullet.Is this a problem with Flash or is the font file somehow missing the bullet character, and does anyone know how I can fix this issue, preferably without having to move across to TLF text.?
View 1 Replies
Jan 6, 2010
I have a project coming up where I'll be rendering text paths on a circle; the text has to be dynamic, so I can't just bring in a precomputed set from illustrator. Now, laying text on a circle ought not be too hard, I'll do it per character with per character rotation. The trouble is, I can't seem to figure out how to get per-character advance from flash's font engine. It's 99% probable that I'm just overlooking something obvious. But as far as I can tell, the only way to get flash font metrics is via flash.text.engine.FontMetrics which ostensibly is per-font, not per-character.
A fallback that I'm not looking forward to implementing is pre-computing per-char advance on my own ( since this project will be using embedded fonts known in advance ). I've got ObjC code lying around for generating glyph maps for opengl, so I could generate that data offline and make it available to my flash code ( probably as static constants or some malarkey ).
View 3 Replies
Aug 20, 2009
This is a rather advanced problem but apparently I'm not the only one having it.So far I've been using external font loading in all my projects. A Tahoma.swf with a Tahoma Font library item and basically two lines of code:ActionScript Code:import flash.text.Font;Font.registerFont(TahomaSmooth);As soon as I load the font in my application it's ready for use. This is Jesse Freeman's method, in case it looks familiar.The problem is Flash CS4 doesn't embed polish fonts. And clients dnt lke t read tet that hs mssng chrcters. Unfortunately for anyone who isn't english Adobe didn't forsee that people might actually want to specify the character set when embeding Fonts. This strikes me as odd, as supposedly the whole font was supposed to be imported, at least that's how it originally worked, AFAIK.
View 9 Replies
Jan 11, 2011
Is it possible?
I am talking about special character, "|" to be exact.
View 0 Replies
Jun 2, 2010
We have installed FMS and have used it for a live streaming video event.The event lasted an hour and FMS worked great.How can I get statistics on that live stream? I'd like to know how many people saw the video, and how many people were watching at one time.
View 1 Replies
Oct 9, 2010
I am tasked with created a site that handles Japanese characters, and am looking for any insight you can offer for this.My main issue right now is the size spike the site will get if I embed a font like "Arial Unicode MS" with the Kanji character set which has 3174 glyphs. When I compiled an fla with only a textfield and these Japanese characters embed it stands at 731k. So I am looking for options to either eliminate the need to embed the Kanji characters or find a way to limit the number of characters needed to handle the Kanji character set.
1. Which fonts if any come pre-installed on Wins & Mac that natively handle Kanji characters.
2. If there is such a font for Win & Mac does this mean I don't need to embed the Kanji glyphs for the font in a swf, and can be sure any user viewing the site will be able to see the Janji characters, because their OS already can handle displaying Janji characters. For example if I go to a webpage on the internet that has Japanese characters I am able to view the Japanese characters, is this because the browsers themselves have these fonts embedded or is it pulling from my OS to display the Japanese font?
3. If I do need to embed a font to handle the Janji characters do I need to include all 3174 glyphs to cover all possible English equivalents. I read that you can specify a unicode range for a font, believe this only works with CS4 though. I don't know much about unicode ranges let allow the ranges I need for Japanese characters.
View 8 Replies
Feb 15, 2010
whats the best way to track user clicks within a swf running online(AS3)?
View 2 Replies
Apr 14, 2010
I have a skin that's base clas is GraphicRectangularBorderSkin (from degrafa). I'm using it as a panel skin. I'm using Degrafa 3.2, Flex 3.2. It throws a #1502 error (thrown when a script runs too long) every time. If I remove the line changing the em variable, the error goes away.The class is basically (although I paraphrased for the sake of clarity):[code]
View 1 Replies
Aug 5, 2011
So we're trying to come up with a way to automatically assess the "quality" of streams published to an FMS. So far, I've come down to 3 different statistics:
* Round-trip ping time to client (using the Client.ping() method and Client.getStats().ping_rtt.
* A home-grown jitter calculation that compares the deviation between wallclock and media time for an inbound stream, e.g., I get N+/-M seconds of media over a period of N seconds of wallclock time. How big is M on average? (uses Stream.time and Date.getTime()).
* How much packet loss are we getting?
For this third metric, I have the client sending up period reports containing tuples of <media_time, cum_bytes_sent>, where media_time is provided by NetStream.time and cum_bytes_sent is provided by NetStreamInfo.byteCount. I'm then comparing these samples to a similar set of samples obtained on the server via Stream.time and Client.getStats().bytes_in. Unfortunately, these two data sources do not seem to be measuring exactly the same thing. While they are close to each other, the received bandwidth (e.g., measured by the server) always seems to exceed the sent bandwidth (measured by the client) by a small amount (e.g., 0.5% to 2%) on a clean network.
The goal of this whole exercise is to enable to server to automatically detect when a client is having problems (either network or local CPU). Among other things, this will trigger us to tell the client to try sending a lower-bitrate stream.
So, my questions:
* Is there a method for me to reliably calculate (or obtain) a packet loss factor? With something like RTP, I could simply look for holes in sequence numbers, but I don't see any APIs that would give me that sort of information via FMS (our inbound streams are usually RTMFP).
* If there isn't a way for me to get a clean packet loss factor, is there another quality metric I should be looking at?
View 12 Replies
Feb 7, 2011
I'm trying to embed a font in my project by using url("font.ttf") rather than local("Font Name"), but it doesn't seem to pick it up. The font in question is called "Gotham Bold". When i view the details of the font, the font weight is regular, however when i use local("Gotham Bold") in the css i have to specify fontWeight: bold or else it wont pick it up. But when I use url("folderGotham-Bold.ttf"), and specify fontWeight: bold, it says that font weight is not found for that TTF. If i remove the fontweight, there's no errors, but the font is not applied to the text.
View 2 Replies
Jan 25, 2011
I've been searching around the internet for a while to store a click counter within a flash video. Basically count how many times a video was actually viewed instead of the page being loaded.I have a few restrictions.I cannot use a server side language.I cannot use a database.(I want to use a text file stored on the server)
View 2 Replies
Sep 24, 2010
I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.
View 4 Replies
Nov 27, 2010
Does anyone know the regular expression to test if a single string character has both upper and lower case character?
eg. All A-Z and a-z.
View 0 Replies
Aug 11, 2009
i was wondering if any of you out there could tell me how it is possible to make a movieclip of a character and when the character is dragged about the screen by the curser, how do you make the characters arms and legs swing about in a realistic fashion.
View 2 Replies
May 10, 2011
I'm using the following method to dispatch a sound in X times/minute (X is determined through bpm, which is a NumericStepper object)
var mainTimer:Timer = new Timer(60 / (bpm.value * 1000),0);
mainTimer.addEventListener(TimerEvent.TIMER, fl_TimerHandler,false, 0, true);
mainTimer.start();
[code].....
View 2 Replies
Sep 30, 2010
I've used the sortOn function (dp.sortOn("cost");) to sort my dataprovider values based on cost. It works great until I get values over 100. Then it thinks that 250 < 50.
View 2 Replies
Oct 25, 2010
Any troubles when compressing red colours to .swf? I always have a kind of blur in edges, like dirty compression.
View 1 Replies
Jul 18, 2011
My FLV is paused and I do a seek to FLVPlayback.playheadTime-1. This i.e. equals to 22-1=21. It works, but than VideoEvent.PAUSED_STATE_ENTERED is called and my trace shows playheadTime = 22 and nothing changed. If I seek to playheadTime+1. This i.e. equals to 22+1=23 my onPaused trace shows playheadTime = 24 and my FLV advanced 2 sec. not 1. So there is always 1 sec. added to playheadTime and its cut to absolut .000 numbers.
It seems like FLVPlayback alligns my seek into blocks of 2 seconds. But I need to position more accurately and jump in half seconds even.
[Code].....
View 6 Replies
Dec 7, 2009
I'm trying to sync animation to music at a specific BPM. I've tried using the Timer but it isn't accurate when dealing with small intervals in milliseconds. I did some reading and found an alternate method that uses a small silent audio file and the SOUND_COMPLETE event as a Timer.[code]...
View 4 Replies
Jan 11, 2011
The timer class seems to accrue a lot of error over time so I'm wondering what other solutions people have come up with for a more accurate Timer.
View 4 Replies
Jan 4, 2004
I was wondering how you get the collsion detection to be just what is in the MCs instead of a rectangularness of the movieClip.
View 8 Replies
Aug 22, 2004
i got a problem with a nice skew function From Ericlin of URL...[code]i have prepared a small and plain .fla for you so you can check it out right here, its also attached to the posting (Flash MX 2004 File but should be ok for earlier versions?):url...while the borders of isometric walls are still exactly vertical (90 deg) the function is producing lines which are very slightly skew. might be something like 90.1 deg... but this inaccurancy produces ugly gaps between walls i put together later.This function is maybe not accurate enough, maybe to accurate, i am not sure. But i need probably some rounding in there but i dont know where, really (is that a wonder? look at the script! ;))when you zoom in and look at the "orientation bar" (thick dark blue bar), you will notice that there is a very small gap on the top right corner but its bigger on the bottom right corner of the wall texture.
View 1 Replies
Nov 7, 2004
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3 swf it comes back to the first one, somebody has an idea of as I can make this?
View 5 Replies
Jun 28, 2007
I need to make a countdown timer in Flash that will countdown in seconds to the next whole hour and then will reset and countdown to the following next hour The timer needs to be 100% accurate. Is it possible to create a countdown timer in actionscript which will be perfectly accurate - ie. will always be identical when compared with actual rea-life time, irrespective of the hardware, processing of applications done on a client machine?If this is not possible, is it possible to include in the code a detection of when the timer becomes inaccurate and then further code to get it back on track to correct the inaccuracy?
View 8 Replies
Nov 8, 2009
After wrestling this flash flv slideshow for the last few days, I finally have it running smoothly locally. The problem is that on a server it has serious issues. I see a blank screen where the flv should be... I assume it's still loading or buffering. That's a problem as is, but when it's in this state, nothing else works on the site (flash site-one swf). If you wait for sometimes 10 minutes the flv finally shows and the site works great. All of this obviously depends on the connection.
So I understand that this could be caused by the size of the 10 flvs. I'm using the FLVplayback component by the way. So that's fine for now, but I just want a preloader at the beginning to only go to frame 2 after the intro flv has been loaded. I thought this would be simple using bytesTotal and bytesLoaded. I was wrong. Below is the code I'm using. When you view the page the preloader seems to work, but after it runs - you are directed to the second frame... showing the "skip intro" button (which doesn't exist on the 1st frame)... but the flv doesn't show. It's actually still loading... 5-10 minutes later it shows up and the site works fine. My preloader isn't showing the progress of the flv load.
You can see what I'm talking about by viewing my project... if you're on a connection like mine you won't be seeing much: [URL]
Does anyone know of a preloader specifically for FLVs... maybe one that reads the buffer progress?
[Code].....
View 5 Replies
Mar 3, 2011
I use flvplayback to play a 20 seconds flv video, but I can't get accurate playheadTime no matter how to set the attributes.
Here is my as3 codes.
import mx.video.*;my_FLVPlybk.playheadUpdateInterval=10;//my_FLVPlybk.seekBarInterval=100;//FLVPlayback.seekBarScrubTolerance=100;function the_play(eventObject:Object){ ta.text = my_FLVPlybk.playheadTime; // ta is a textarea.}function the_end(eventObject:Object){ ta.text = "video over";}my_FLVPlybk.addEventListener("playheadUpdate", the_play);my_FLVPlybk.addEventListener("complete", the_end);
I drag seekbar to between 0 and 8 seconds, it always obliges to 8.333 .
View 1 Replies
Mar 17, 2010
For a schoolassigment me and some buddies of mine are creating an application that is showing many similarities with the C-Mon & Kypski musicvideo on [URL]. The application is being developed in Flex.
We want to get a random point of a clip, let it pause so a user can mimic the pose and make a snapshot out of it.
What i managed to do is get a random point of the movie. I did this by getting a random value between 0 and de total duration of the movie.
But what i didn't managed to do is let the screen pause on every 24st of a frame. As the movie concist out of 24FPS. It looks like the the random value of the movie that is being requested is being rounded by the movie itself. As example: There appears to be no difference between the frames requested at 2.40 or 2.41.
It appears it got something to do with keyframing i've read on the Adobe® Flex™ 3.5 Language Reference. The movie is a FLV file and i use the VideoDisplay object to display the movie.
View 1 Replies