![JAR search and dependency download from the Maven repository](/logo.png)
com.bugvm.apple.coretext.CTFontDescriptor Maven / Gradle / Ivy
/*
* Copyright (C) 2013-2015 RoboVM AB
*
* Licensed 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 com.bugvm.apple.coretext;
/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coremedia.*;
import com.bugvm.apple.uikit.*;
/* */
/**/
/* */
/**/@Library("CoreText")/* */
/**/public/* */ class /**/CTFontDescriptor/* */
extends /**/CFType/* */
/**//* */ {
public static class AsListMarshaler {
@MarshalsPointer
public static List> toObject(Class extends CFType> cls, long handle, long flags) {
CFArray o = (CFArray) CFType.Marshaler.toObject(cls, handle, flags);
if (o == null) {
return null;
}
return o.toList(CTFontDescriptor.class);
}
@MarshalsPointer
public static long toNative(List extends CFType> l, long flags) {
if (l == null) {
return 0L;
}
CFArray o = null;
if (l instanceof CFArray) {
o = (CFArray) l;
} else {
o = CFArray.create((List extends CFType>) l);
}
return CFType.Marshaler.toNative(o, flags);
}
}
public interface ProgressHandler {
boolean invoke(CTFontDescriptorMatchingState state, CTFontDescriptorProgressData data);
}
private static final java.lang.reflect.Method cbProgress;
private static ProgressHandler progressHandler;
static {
try {
cbProgress = CTFontDescriptor.class.getDeclaredMethod("cbProgress", CTFontDescriptorMatchingState.class, CFDictionary.class);
} catch (Throwable e) {
throw new Error(e);
}
}
/**/public static class CTFontDescriptorPtr extends Ptr {}/* */
/**/static { Bro.bind(CTFontDescriptor.class); }/* */
/**//* */
/**/
protected CTFontDescriptor() {}
/* */
/**//* */
/**//* */
@Callback
private static boolean cbProgress(CTFontDescriptorMatchingState state, CFDictionary data) {
return progressHandler.invoke(state, new CTFontDescriptorProgressData(data));
}
/**
* @since Available in iOS 3.2 and later.
*/
public List createMatchingFontDescriptors(List mandatoryAttributes) {
CFSet set = CFMutableSet.create();
for (CTFontAttribute attr : mandatoryAttributes) {
set.add(attr.value());
}
return createMatchingFontDescriptors(set).toList(CTFontDescriptor.class);
}
/**
* @since Available in iOS 3.2 and later.
*/
public CTFontDescriptor createMatchingFontDescriptor(List mandatoryAttributes) {
CFSet set = CFMutableSet.create();
for (CTFontAttribute attr : mandatoryAttributes) {
set.add(attr.value());
}
return createMatchingFontDescriptor(set);
}
/**
* @since Available in iOS 6.0 and later.
*/
public static boolean matchFontDescriptors(List descriptors, List mandatoryAttributes, ProgressHandler progressHandler) {
CTFontDescriptor.progressHandler = progressHandler;
CFSet set = CFMutableSet.create();
for (CTFontAttribute attr : mandatoryAttributes) {
set.add(attr.value());
}
return matchFontDescriptors(CFArray.create(descriptors), set, new FunctionPtr(cbProgress));
}
/**
* @since Available in iOS 3.2 and later.
*/
public CFType getLocalizedAttribute(CTFontAttribute attribute) {
return getLocalizedAttribute(attribute, null);
}
/**/
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorGetTypeID", optional=true)
public static native @MachineSizedUInt long getClassTypeID();
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateWithNameAndSize", optional=true)
public static native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CTFontDescriptor create(String name, @MachineSizedFloat double size);
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateWithAttributes", optional=true)
public static native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CTFontDescriptor create(CTFontAttributes attributes);
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateCopyWithAttributes", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CTFontDescriptor createCopy(CTFontAttributes attributes);
/**
* @since Available in iOS 7.0 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateCopyWithFamily", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CTFontDescriptor createCopy(String family);
/**
* @since Available in iOS 7.0 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateCopyWithSymbolicTraits", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CTFontDescriptor createCopy(CTFontSymbolicTraits symTraitValue, CTFontSymbolicTraits symTraitMask);
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateMatchingFontDescriptors", optional=true)
protected native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CFArray createMatchingFontDescriptors(CFSet mandatoryAttributes);
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCreateMatchingFontDescriptor", optional=true)
protected native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CTFontDescriptor createMatchingFontDescriptor(CFSet mandatoryAttributes);
/**
* @since Available in iOS 6.0 and later.
*/
@Bridge(symbol="CTFontDescriptorMatchFontDescriptorsWithProgressHandler", optional=true)
protected static native boolean matchFontDescriptors(CFArray descriptors, CFSet mandatoryAttributes, FunctionPtr progressBlock);
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCopyAttributes", optional=true)
public native CTFontAttributes getAttributes();
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCopyAttribute", optional=true)
public native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CFType getAttribute(CTFontAttribute attribute);
/**
* @since Available in iOS 3.2 and later.
*/
@Bridge(symbol="CTFontDescriptorCopyLocalizedAttribute", optional=true)
protected native @com.bugvm.rt.bro.annotation.Marshaler(CFType.NoRetainMarshaler.class) CFType getLocalizedAttribute(CTFontAttribute attribute, CFString.CFStringPtr language);
/* */
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy