You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EmbeddingMode.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.fonts;
  19. /**
  20. * This enumerates the embedding mode of fonts; full; subset; auto (auto defaults to full for
  21. * type1 fonts and subset for truetype fonts.
  22. */
  23. public enum EmbeddingMode {
  24. /** Default option: assumes FULL for type1 fonts and SUBSET for truetype fonts. */
  25. AUTO,
  26. /** Full font embedding: This means the whole of the font is written to file. */
  27. FULL,
  28. /** Subset font embedding: Only the mandatory tables and a subset of glyphs are written
  29. * to file.*/
  30. SUBSET;
  31. /**
  32. * Returns the name of this embedding mode.
  33. * @return String - lower case.
  34. */
  35. public String getName() {
  36. return this.toString().toLowerCase();
  37. }
  38. /**
  39. * Returns {@link EmbeddingMode} by name.
  40. * @param value String - the name of the embedding mode (not case sensitive).
  41. * @return embedding mode constant.
  42. */
  43. public static EmbeddingMode getValue(String value) {
  44. for (EmbeddingMode mode : EmbeddingMode.values()) {
  45. if (mode.toString().equalsIgnoreCase(value)) {
  46. return mode;
  47. }
  48. }
  49. throw new IllegalArgumentException("Invalid embedding-mode: " + value);
  50. }
  51. }