Repository: flex-falcon Updated Branches: refs/heads/develop 7dde95caa -> b26f99431
copy font files Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b0edd99f Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b0edd99f Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b0edd99f Branch: refs/heads/develop Commit: b0edd99fbea99f6c1c0f2c7e15aff0b8037bf0ca Parents: 7dde95c Author: Alex Harui <aha...@apache.org> Authored: Fri Jul 17 12:59:21 2015 -0700 Committer: Alex Harui <aha...@apache.org> Committed: Tue Jul 28 11:42:42 2015 -0700 ---------------------------------------------------------------------- .../mxml/flexjs/MXMLFlexJSPublisher.java | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b0edd99f/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java index cf3869b..975fb8a 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java @@ -41,11 +41,15 @@ import org.apache.commons.io.filefilter.RegexFileFilter; import org.apache.flex.compiler.clients.problems.ProblemQuery; import org.apache.flex.compiler.codegen.js.IJSPublisher; import org.apache.flex.compiler.config.Configuration; +import org.apache.flex.compiler.css.ICSSPropertyValue; import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens; import org.apache.flex.compiler.internal.codegen.js.JSSharedData; import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens; import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens; import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogPublisher; +import org.apache.flex.compiler.internal.css.CSSArrayPropertyValue; +import org.apache.flex.compiler.internal.css.CSSFontFace; +import org.apache.flex.compiler.internal.css.CSSFunctionCallPropertyValue; import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession; import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration; import org.apache.flex.compiler.internal.graph.GoogDepsWriter; @@ -618,5 +622,59 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher { JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession(); writeFile(dirPath + File.separator + projectName + ".css", cssSession.emitCSS(), false); + for (CSSFontFace fontFace : cssSession.fontFaces) + { + // check frameworks/fonts folder + String configdir = ((JSGoogConfiguration) configuration).getLoadConfig(); + File dir = new File(configdir); + dir = dir.getParentFile(); + for (ICSSPropertyValue prop : fontFace.getSources()) + { + if (prop instanceof CSSArrayPropertyValue) + { + for (ICSSPropertyValue value : ((CSSArrayPropertyValue)prop).getElements()) + { + CSSFunctionCallPropertyValue fn = (CSSFunctionCallPropertyValue)value; + String fontPath = fn.rawArguments; + if (fontPath.startsWith("'")) + fontPath = fontPath.substring(1, fontPath.length() - 1); + if (fontPath.startsWith("\"")) + fontPath = fontPath.substring(1, fontPath.length() - 1); + int c = fontPath.indexOf("?"); + if (c != -1) + fontPath = fontPath.substring(0, c); + File fontFile = new File(dir.getAbsolutePath() + File.separator + fontPath); + File destFile = new File(dirPath + File.separator + fontPath); + if (fontFile.exists()) + { + if (!destFile.exists()) + FileUtils.copyFile(fontFile, destFile); + } + } + } + else + { + if (prop instanceof CSSFunctionCallPropertyValue) + { + CSSFunctionCallPropertyValue fn = (CSSFunctionCallPropertyValue)prop; + String fontPath = fn.rawArguments; + if (fontPath.startsWith("'")) + fontPath = fontPath.substring(1, fontPath.length() - 1); + if (fontPath.startsWith("\"")) + fontPath = fontPath.substring(1, fontPath.length() - 1); + int c = fontPath.indexOf("?"); + if (c != -1) + fontPath = fontPath.substring(0, c); + File fontFile = new File(dir.getAbsolutePath() + File.separator + fontPath); + File destFile = new File(dirPath + File.separator + fontPath); + if (fontFile.exists()) + { + if (!destFile.exists()) + FileUtils.copyFile(fontFile, destFile); + } + } + } + } + } } }