選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

EncodingMode.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 class enumerates all supported encoding modes for fonts: auto, single-byte and CID.
  21. */
  22. public enum EncodingMode {
  23. /** Automatic selection of encoding mode. */
  24. AUTO("auto"),
  25. /** Single-byte encoding */
  26. SINGLE_BYTE("single-byte"),
  27. /** CID encoding */
  28. CID("cid");
  29. private String name;
  30. private EncodingMode(String name) {
  31. this.name = name;
  32. }
  33. /**
  34. * Returns the encoding mode name.
  35. * @return the encoding mode name
  36. */
  37. public String getName() {
  38. return this.name;
  39. }
  40. /**
  41. * Returns the {@link EncodingMode} by name.
  42. * @param name the name of the encoding mode to look up
  43. * @return the encoding mode constant
  44. */
  45. public static EncodingMode getValue(String name) {
  46. for (EncodingMode em : EncodingMode.values()) {
  47. if (name.equalsIgnoreCase(em.getName())) {
  48. return em;
  49. }
  50. }
  51. throw new IllegalArgumentException("Invalid encoding mode: " + name);
  52. }
  53. /** {@inheritDoc} */
  54. public String toString() {
  55. return "EncodingMode: " + getName();
  56. }
  57. }