Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-scratchpad-5.2.3.jar?
What Is poi-scratchpad-5.2.3.jar?
✍: FYIcenter.com
poi-scratchpad-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-scratchpad-5.2.3.jar provides support for older versions of Microsoft document files like Word 97, Excel 97, PowerPoint 97, etc.
poi-scratchpad-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-scratchpad-5.2.3.jar Target JDK version: 9 Dependency: poi.jar File name: poi-scratchpad.jar, poi-scratchpad-5.2.3.jar File size: 1897121 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-scratchpad-5.2.3.jar:
⏎ org/apache/poi/hslf/record/FontEntityAtom.java
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.record;
import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Supplier;
import org.apache.poi.common.usermodel.fonts.FontFamily;
import org.apache.poi.common.usermodel.fonts.FontPitch;
import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
/**
* This atom corresponds exactly to a Windows Logical Font (LOGFONT) structure.
* It keeps all the information needed to define the attributes of a font,
* such as height, width, etc. For more information, consult the
* Windows API Programmer's reference.
*/
public final class FontEntityAtom extends RecordAtom {
private static final int[] FLAGS_MASKS = {
0x0001, 0x0100, 0x0200, 0x0400, 0x0800
};
private static final String[] FLAGS_NAMES = {
"EMBED_SUBSETTED",
"RASTER_FONT",
"DEVICE_FONT",
"TRUETYPE_FONT",
"NO_FONT_SUBSTITUTION"
};
/**
* record header
*/
private final byte[] _header;
/**
* record data
*/
private byte[] _recdata;
/**
* Build an instance of <code>FontEntityAtom</code> from on-disk data
*/
/* package */ FontEntityAtom(byte[] source, int start, int len) {
// Get the header
_header = Arrays.copyOfRange(source, start, start+8);
// Grab the record data
_recdata = IOUtils.safelyClone(source, start+8, len-8, getMaxRecordLength());
}
/**
* Create a new instance of <code>FontEntityAtom</code>
*/
public FontEntityAtom() {
_recdata = new byte[68];
_header = new byte[8];
LittleEndian.putShort(_header, 2, (short)getRecordType());
LittleEndian.putInt(_header, 4, _recdata.length);
}
@Override
public long getRecordType() {
return RecordTypes.FontEntityAtom.typeID;
}
/**
* A null-terminated string that specifies the typeface name of the font.
* The length of this string must not exceed 32 characters
* including the null terminator.
* @return font name
*/
public String getFontName(){
final int maxLen = Math.min(_recdata.length,64)/2;
return StringUtil.getFromUnicodeLE0Terminated(_recdata, 0, maxLen);
}
/**
* Set the name of the font.
* The length of this string must not exceed 32 characters
* including the null terminator.
* Will be converted to null-terminated if not already
* @param name of the font
*/
public void setFontName(String name) {
// Ensure it's not now too long
int nameLen = name.length() + (name.endsWith("\u0000") ? 0 : 1);
if (nameLen > 32) {
throw new HSLFException("The length of the font name, including null termination, must not exceed 32 characters");
}
// Everything's happy, so save the name
byte[] bytes = StringUtil.getToUnicodeLE(name);
System.arraycopy(bytes, 0, _recdata, 0, bytes.length);
// null the remaining bytes
Arrays.fill(_recdata, bytes.length, 64, (byte)0);
}
public void setFontIndex(int idx){
LittleEndian.putShort(_header, 0, (short)idx);
}
public int getFontIndex(){
return LittleEndian.getShort(_header, 0) >> 4;
}
/**
* set the character set
*
* @param charset - characterset
*/
public void setCharSet(int charset){
_recdata[64] = (byte)charset;
}
/**
* get the character set
*
* @return charset - characterset
*/
public int getCharSet(){
return _recdata[64];
}
/**
* set the font flags
* Bit 1: If set, font is subsetted
*
* @param flags - the font flags
*/
public void setFontFlags(int flags){
_recdata[65] = (byte)flags;
}
/**
* get the character set
* Bit 1: If set, font is subsetted
*
* @return the font flags
*/
public int getFontFlags(){
return _recdata[65];
}
/**
* set the font type
* <p>
* Bit 1: Raster Font
* Bit 2: Device Font
* Bit 3: TrueType Font
* </p>
*
* @param type - the font type
*/
public void setFontType(int type){
_recdata[66] = (byte)type;
}
/**
* get the font type
* <p>
* Bit 1: Raster Font
* Bit 2: Device Font
* Bit 3: TrueType Font
* </p>
*
* @return the font type
*/
public int getFontType(){
return _recdata[66];
}
/**
* set lfPitchAndFamily
*
*
* @param val - Corresponds to the lfPitchAndFamily field of the Win32 API LOGFONT structure
*/
public void setPitchAndFamily(int val){
_recdata[67] = (byte)val;
}
/**
* get lfPitchAndFamily
*
* @return corresponds to the lfPitchAndFamily field of the Win32 API LOGFONT structure
*/
public int getPitchAndFamily(){
return _recdata[67];
}
/**
* Write the contents of the record back, so it can be written to disk
*/
@Override
public void writeOut(OutputStream out) throws IOException {
out.write(_header);
out.write(_recdata);
}
@Override
public Map<String, Supplier<?>> getGenericProperties() {
return GenericRecordUtil.getGenericProperties(
"fontName", this::getFontName,
"fontIndex", this::getFontIndex,
"charset", this::getCharSet,
"fontFlags", getBitsAsString(this::getFontFlags, FLAGS_MASKS, FLAGS_NAMES),
"fontPitch", () -> FontPitch.valueOfPitchFamily((byte)getPitchAndFamily()),
"fontFamily", () -> FontFamily.valueOfPitchFamily((byte)getPitchAndFamily())
);
}
}
⏎ org/apache/poi/hslf/record/FontEntityAtom.java
Or download all of them as a single archive file:
File name: poi-scratchpad-5.2.3-src.zip File size: 1238744 bytes Release date: 2022-09-09 Download
⇒ What Is poi-examples-5.2.3.jar?
⇐ What Is poi-excelant-5.2.3.jar?
2017-03-22, ≈121🔥, 0💬
Popular Posts:
JDK 11 java.security.jgss.jmod is the JMOD file for JDK 11 Security JGSS (Java Generic Security Serv...
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...
io.jar is a component in iText Java library to provide input/output functionalities. iText Java libr...
JDK 11 jdk.jfr.jmod is the JMOD file for JDK 11 JFR module. JDK 11 JFR module compiled class files a...
Where to get the Java source code for Connector/J 8.0 Protocol Impl module? Java source code files f...