• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Remove Auto Kern from entire document

New Here ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

I am trying to convert a series of flash site documents to an HTML5 canvas. They're pretty basic, a few moving elements and some buttons, but it seems like all of my text has "Auto Kern" checked. I've found that if I have a single piece of text with Auto Kern on, the document (once published) will not play. Is there a way remove Auto Kern from everything, with a script or otherwise? For each of these documents I've been playing Where's Kern for hours, and it feels like there must be a better way. Is it possible to do with scripts?

 

Any advice would be greatly appreciated.

TOPICS
ActionScript

Views

346

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 30, 2020 Oct 30, 2020

The presence of Auto Kern in a converted document shouldn't stop it from playing. At most it should just generate a warning when you publish. That's all that used to happen.

 

Well, that being said, try copying this script into a .jsfl file and running it when your document is loaded. It should strip all the auto kerning from a document. Not extensively tested, but seems to work.

function main() {
	var dom = fl.getDocumentDOM();
	scanLibrary(dom.library.items);
	scanTimeline(dom.getTimeline());
...

Votes

Translate

Translate
LEGEND ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

The presence of Auto Kern in a converted document shouldn't stop it from playing. At most it should just generate a warning when you publish. That's all that used to happen.

 

Well, that being said, try copying this script into a .jsfl file and running it when your document is loaded. It should strip all the auto kerning from a document. Not extensively tested, but seems to work.

function main() {
	var dom = fl.getDocumentDOM();
	scanLibrary(dom.library.items);
	scanTimeline(dom.getTimeline());
	alert("Scan complete!");
}

function scanLibrary(libItems) {
	var i, item;
	for (i in libItems) {
		item = libItems[i];
		if (["movie clip", "graphic", "button"].indexOf(item.itemType) != -1) {
			scanTimeline(item.timeline);
		}
	}
}

function scanTimeline(timeline) {
	var layer, frames, element, member, frameSet, elementSet, memberSet;
	var	layerSet = timeline.layers;
	for (layer in layerSet) {
		frameSet = layerSet[layer].frames;
		for (frame in frameSet) {
			elementSet = frameSet[frame].elements;
			for (element in elementSet) {
				changeText(elementSet[element]);
				memberSet = elementSet[element].members;
				if (memberSet != undefined) {
					for (member in memberSet) {
						changeText(memberSet[member]);
					}
				}
			}
		}
	}
}

function changeText(item) {
	if (item.textRuns) {
		for (var txt in item.textRuns) {
			item.textRuns[txt].textAttrs.autoKern = false;
		}
	}
}

main();

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

This script is absolutely awesome. Did the trick.

 

Should I be worried that some of these files weren't working with auto-kern enabled on text? I determined that it was causing issues by laboriously deleting layers, by process of elimination. I found that if I had a single layer with Auto Kern checked anywhere on the timeline, the published HTML5 file would just load as the background color... If I unchecked auto-kern, then bam, it would load just fine... Is that a sign that there's something more systemically wrong with my projects? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

@etguillemette : In HTML5 canvas documents, auto kern is not supported for dynamic text and will be removed for converted documents. Could you please share a sample project where it is causing issues in HTML5 canvas output on publishing or, submit a bug report with file links. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 08, 2020 Nov 08, 2020

Copy link to clipboard

Copied

LATEST

Okay, I think I might have had multiple issues going on... Unchecking Auto-kern, for whatever reason sometimes fixed it, but in other cases I think I had used the same instance name twice, and it was giving me a blank canvas when published.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

And thank you. I really appreciate you taking the time to write out a script, above and beyond anything I was expecting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

It was just an adaptation of a script I already had laying around.

 

Whenever a Canvas document comes up blank, you should check the browser developer console for errors.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines