001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Ilya S. Okomin
019: * @version $Revision$
020: */package org.apache.harmony.awt.gl.font;
021:
022: /**
023: * Class containing font property information. This information can be found
024: * in font.property files. See API documentation, logical fonts description part.
025: *
026: */
027: public class FontProperty {
028:
029: // font file name
030: String fileName = null;
031:
032: // name of the encoding to be used
033: String encoding = null;
034:
035: // array of exclusion ranges (pairs of low and high unicode exclusion bounds)
036: int[] exclRange = null;
037:
038: // font face name
039: String name = null;
040:
041: // font style
042: int style = -1;
043:
044: /**
045: * Returns font style of this font property.
046: */
047: public int getStyle() {
048: return this .style;
049: }
050:
051: /**
052: * Returns font name of this font property.
053: */
054: public String getName() {
055: return this .name;
056: }
057:
058: /**
059: * Returns encoding used in this font property.
060: */
061: public String getEncoding() {
062: return this .encoding;
063: }
064:
065: /**
066: * Returns an array of exclusion ranges. This array contain pairs of
067: * low and high bounds of the intervals of characters to ignore in
068: * total Unicode characters range.
069: */
070: public int[] getExclusionRange() {
071: return this .exclRange;
072: }
073:
074: /**
075: * Returns file name of the font that is described by this font property.
076: */
077: public String getFileName() {
078: return this .fileName;
079: }
080:
081: /**
082: * Returns true if specified character covered by exclusion ranges of this
083: * font property, false otherwise.
084: *
085: * @param ch specified char to check
086: */
087: public boolean isCharExcluded(char ch) {
088: if (exclRange == null) {
089: return false;
090: }
091:
092: for (int i = 0; i < exclRange.length;) {
093: int lb = exclRange[i++];
094: int hb = exclRange[i++];
095:
096: if (ch >= lb && ch <= hb) {
097: return true;
098: }
099: }
100:
101: return false;
102: }
103: }
|