All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugvm.apple.coretext.CTFontManager Maven / Gradle / Ivy

The newest version!
/*
 * 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 /**/CTFontManager/**/ 
    extends /**/CocoaUtility/**/ 
    /**//**/ {

    public static class Notifications {
        /**
         * @since Available in iOS 7.0 and later.
         */
        public static NSObject observeRegisteredFontsChanged(final Runnable block) {
            return NSNotificationCenter.getDefaultCenter().addObserver(RegisteredFontsChangedNotification(), null, NSOperationQueue.getMainQueue(), new VoidBlock1() {
                @Override
                public void invoke (NSNotification a) {
                    block.run();
                }
            });
        }
    }

    /**/
    /**/
    /**/static { Bro.bind(CTFontManager.class); }/**/
    /**//**/
    /**//**/
    /**//**/
    /**//**/
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean registerFonts(List fontURLs, CTFontManagerScope scope) {
        return registerFonts(new NSArray<>(fontURLs), scope, null);
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean registerFonts(NSArray fontURLs, CTFontManagerScope scope) {
        return registerFonts(fontURLs, scope, null);
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean unregisterFonts(List fontURLs, CTFontManagerScope scope) {
        return unregisterFonts(new NSArray<>(fontURLs), scope, null);
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean unregisterFonts(NSArray fontURLs, CTFontManagerScope scope) {
        return unregisterFonts(fontURLs, scope, null);
    }
    /**/
    /**
     * @since Available in iOS 7.0 and later.
     */
    @GlobalValue(symbol="kCTFontManagerRegisteredFontsChangedNotification", optional=true)
    public static native NSString RegisteredFontsChangedNotification();
    
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Bridge(symbol="CTFontManagerCreateFontDescriptorsFromURL", optional=true)
    public static native @com.bugvm.rt.bro.annotation.Marshaler(CTFontDescriptor.AsListMarshaler.class) List createFontDescriptors(NSURL fileURL);
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Bridge(symbol="CTFontManagerCreateFontDescriptorFromData", optional=true)
    public static native CTFontDescriptor createFontDescriptor(NSData data);
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean registerFonts(NSURL fontURL, CTFontManagerScope scope) throws NSErrorException {
       NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
       boolean result = registerFonts(fontURL, scope, ptr);
       if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
       return result;
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    @Bridge(symbol="CTFontManagerRegisterFontsForURL", optional=true)
    private static native boolean registerFonts(NSURL fontURL, CTFontManagerScope scope, NSError.NSErrorPtr error);
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean unregisterFonts(NSURL fontURL, CTFontManagerScope scope) throws NSErrorException {
       NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
       boolean result = unregisterFonts(fontURL, scope, ptr);
       if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
       return result;
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    @Bridge(symbol="CTFontManagerUnregisterFontsForURL", optional=true)
    private static native boolean unregisterFonts(NSURL fontURL, CTFontManagerScope scope, NSError.NSErrorPtr error);
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean registerGraphicsFont(CGFont font) throws NSErrorException {
       NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
       boolean result = registerGraphicsFont(font, ptr);
       if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
       return result;
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    @Bridge(symbol="CTFontManagerRegisterGraphicsFont", optional=true)
    private static native boolean registerGraphicsFont(CGFont font, NSError.NSErrorPtr error);
    /**
     * @since Available in iOS 4.1 and later.
     */
    public static boolean unregisterGraphicsFont(CGFont font) throws NSErrorException {
       NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
       boolean result = unregisterGraphicsFont(font, ptr);
       if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
       return result;
    }
    /**
     * @since Available in iOS 4.1 and later.
     */
    @Bridge(symbol="CTFontManagerUnregisterGraphicsFont", optional=true)
    private static native boolean unregisterGraphicsFont(CGFont font, NSError.NSErrorPtr error);
    /**
     * @since Available in iOS 4.1 and later.
     */
    @Bridge(symbol="CTFontManagerRegisterFontsForURLs", optional=true)
    protected static native boolean registerFonts(NSArray fontURLs, CTFontManagerScope scope, NSArray.NSArrayPtr errors);
    /**
     * @since Available in iOS 4.1 and later.
     */
    @Bridge(symbol="CTFontManagerUnregisterFontsForURLs", optional=true)
    protected static native boolean unregisterFonts(NSArray fontURLs, CTFontManagerScope scope, NSArray.NSArrayPtr errors);
    /**/
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy