FontImpl.java 17.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.agl.util.ULocale
 */
package com.adobe.fontengine.font;

import com.adobe.agl.util.ULocale;
import com.adobe.fontengine.font.CoolTypeScript;
import com.adobe.fontengine.font.Font;
import com.adobe.fontengine.font.FontData;
import com.adobe.fontengine.font.FontLoadingException;
import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.LineMetrics;
import com.adobe.fontengine.font.PDFFontDescription;
import com.adobe.fontengine.font.Permission;
import com.adobe.fontengine.font.Rect;
import com.adobe.fontengine.font.SWFFont4Description;
import com.adobe.fontengine.font.SWFFontDescription;
import com.adobe.fontengine.font.Subset;
import com.adobe.fontengine.font.UnderlineMetrics;
import com.adobe.fontengine.font.UnsupportedFontException;
import com.adobe.fontengine.font.XDCFontDescription;
import com.adobe.fontengine.fontmanagement.CacheSupportInfo;
import com.adobe.fontengine.fontmanagement.Platform;
import com.adobe.fontengine.fontmanagement.fxg.FXGFontDescription;
import com.adobe.fontengine.fontmanagement.platform.PlatformFontDescription;
import com.adobe.fontengine.fontmanagement.postscript.PostscriptFontDescription;
import com.adobe.fontengine.inlineformatting.css20.CSS20FontDescription;
import java.util.Map;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public abstract class FontImpl
implements Font {
    static final long serialVersionUID = 1;

    @Override
    public double getUnitsPerEmX() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getUnitsPerEmX();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public double getUnitsPerEmY() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getUnitsPerEmY();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public LineMetrics getLineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getLineMetrics();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public Rect getCoolTypeGlyphBBox(int glyphID) throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getCoolTypeGlyphBBox(glyphID);
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getCoolTypeLineMetrics();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public CoolTypeScript getCoolTypeScript() throws FontLoadingException, InvalidFontException, UnsupportedFontException {
        try {
            return this.getFontData().getCoolTypeScript();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getCoolTypeUnderlineMetrics();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public Rect getCoolTypeIdeoEmBox() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getCoolTypeIdeoEmBox();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public boolean hasCoolTypeProportionalRoman() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().hasCoolTypeProportionalRoman();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public Rect getCoolTypeIcfBox() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().getCoolTypeIcfBox();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public boolean isSymbolic() throws UnsupportedFontException, InvalidFontException, FontLoadingException {
        try {
            return this.getFontData().isSymbolic();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public boolean canEmbedForEditting() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            Permission thePerm = this.getFontData().getEmbeddingPermission(this.wasEmbedded());
            return thePerm != Permission.RESTRICTED && thePerm != Permission.PREVIEW_AND_PRINT;
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public boolean canEmbedForPrintAndPreview() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.getFontData().getEmbeddingPermission(this.wasEmbedded()) != Permission.RESTRICTED;
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public Subset createSubset() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.getFontData().createSubset();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    public FontData getFontData() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.retrieveFontData();
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public SWFFont4Description getSWFFont4Description() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.retrieveFontData().getSWFFont4Description(this.wasEmbedded());
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public SWFFontDescription getSWFFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.retrieveFontData().getSWFFontDescription(this.wasEmbedded());
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public PDFFontDescription getPDFFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.retrieveFontData().getPDFFontDescription(this);
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public XDCFontDescription getXDCFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return this.retrieveFontData().getXDCFontDescription(this);
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return (PostscriptFontDescription[])this.getFontDescription(PostscriptFontDescription[].class.getSimpleName());
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public CSS20FontDescription[] getCSS20FontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return (CSS20FontDescription[])this.getFontDescription(CSS20FontDescription[].class.getSimpleName());
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public CSS20FontDescription getPreferredCSS20FontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return (CSS20FontDescription)this.getFontDescription(CSS20FontDescription.class.getSimpleName());
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public FXGFontDescription[] getFXGFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        return this.getFXGFontDescription(null, null);
    }

    @Override
    public FXGFontDescription[] getFXGFontDescription(Platform platform) throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        return this.getFXGFontDescription(platform, null);
    }

    @Override
    public FXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            FXGFontDescription[] fxgDesc = (FXGFontDescription[])this.getFontDescription(FXGFontDescription[].class.getSimpleName());
            if (platform == null && locale == null) {
                return fxgDesc;
            }
            int itemCount = 0;
            for (int i = 0; i < fxgDesc.length; ++i) {
                if (platform != null && platform != fxgDesc[i].getPlatform() || locale != null && locale != fxgDesc[i].getLocale()) continue;
                ++itemCount;
            }
            FXGFontDescription[] fxgCopy = new FXGFontDescription[itemCount];
            itemCount = 0;
            for (int i2 = 0; i2 < fxgDesc.length; ++i2) {
                if (platform != null && platform != fxgDesc[i2].getPlatform() || locale != null && locale != fxgDesc[i2].getLocale()) continue;
                fxgCopy[itemCount++] = fxgDesc[i2];
            }
            return fxgCopy;
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    @Override
    public PlatformFontDescription[] getPlatformFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        return this.getPlatformFontDescription(null, null);
    }

    @Override
    public PlatformFontDescription[] getPlatformFontDescription(Platform platform) throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        return this.getPlatformFontDescription(platform, null);
    }

    @Override
    public PlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            PlatformFontDescription[] platDesc = (PlatformFontDescription[])this.getFontDescription(PlatformFontDescription[].class.getSimpleName());
            if (platform == null && locale == null) {
                return platDesc;
            }
            int itemCount = 0;
            for (int i = 0; i < platDesc.length; ++i) {
                if (platform != null && platform != platDesc[i].getPlatform() || locale != null && locale != platDesc[i].getLocale()) continue;
                ++itemCount;
            }
            PlatformFontDescription[] platCopy = new PlatformFontDescription[itemCount];
            itemCount = 0;
            for (int i2 = 0; i2 < platDesc.length; ++i2) {
                if (platform != null && platform != platDesc[i2].getPlatform() || locale != null && locale != platDesc[i2].getLocale()) continue;
                platCopy[itemCount++] = platDesc[i2];
            }
            return platCopy;
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    public CacheSupportInfo getCacheSupportInfo() throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        try {
            return (CacheSupportInfo)this.getFontDescription(CacheSupportInfo.class.getSimpleName());
        }
        catch (InvalidFontException e) {
            e.initFont(this);
            throw e;
        }
        catch (UnsupportedFontException e) {
            e.initFont(this);
            throw e;
        }
    }

    private Object getFontDescription(String type) throws InvalidFontException, UnsupportedFontException, FontLoadingException {
        CSS20FontDescription[] cacheDes = this.getCachedFontDescription(type);
        if (cacheDes == null) {
            if (type.equals("CacheSupportInfo")) {
                cacheDes = this.retrieveFontData().getCacheSupportInfo();
            } else if (type.equals("CSS20FontDescription")) {
                cacheDes = this.retrieveFontData().getPreferredCSS20FontDescription();
            } else if (type.equals("CSS20FontDescription[]")) {
                cacheDes = this.retrieveFontData().getCSS20FontDescription();
            } else if (type.equals("FXGFontDescription[]")) {
                cacheDes = this.retrieveFontData().getFXGFontDescription(null, null);
            } else if (type.equals("PlatformFontDescription[]")) {
                cacheDes = this.retrieveFontData().getPlatformFontDescription(null, null);
            } else if (type.equals("PostscriptFontDescription[]")) {
                cacheDes = this.retrieveFontData().getPostscriptFontDescription();
            } else {
                throw new RuntimeException("Undefined font description class");
            }
            if (cacheDes != null) {
                this.setCachedFontDescription(type, cacheDes);
            }
        }
        return cacheDes;
    }

    public abstract String getCanonicalPath();

    public abstract long getLength();

    public abstract long getLastModified();

    public abstract Object getCachedFontDescription(String var1);

    public abstract Map<String, Object> getCachedFontDescriptionMap();

    public abstract void setCachedFontDescription(String var1, Object var2);

    public boolean wasEmbedded() {
        return false;
    }

    public abstract int hashCode();

    public abstract boolean equals(Object var1);

    public abstract String toString();

    protected abstract FontData retrieveFontData() throws InvalidFontException, UnsupportedFontException, FontLoadingException;
}