public void generatePushValue(final GeneratorAdapter generator, final Object value) {
   FontDescriptor descriptor = (FontDescriptor) value;
   if (descriptor.isFixedFont()) {
     if (!descriptor.isFullyDefinedFont())
       throw new IllegalStateException("Unexpected font state");
     generator.newInstance(ourFontType);
     generator.dup();
     generator.push(descriptor.getFontName());
     generator.push(descriptor.getFontStyle());
     generator.push(descriptor.getFontSize());
     generator.invokeConstructor(ourFontType, ourInitMethod);
   } else if (descriptor.getSwingFont() != null) {
     generator.push(descriptor.getSwingFont());
     generator.invokeStatic(ourUIManagerType, ourUIManagerGetFontMethod);
   } else {
     throw new IllegalStateException("Unknown font type");
   }
 }
  public static void generatePushFont(
      final GeneratorAdapter generator,
      final int componentLocal,
      final LwComponent lwComponent,
      final FontDescriptor descriptor,
      final String readMethodName) {
    final int fontLocal = generator.newLocal(ourFontType);

    generator.loadLocal(componentLocal);
    Type componentType = AsmCodeGenerator.typeFromClassName(lwComponent.getComponentClassName());
    Method getFontMethod = new Method(readMethodName, ourFontType, new Type[0]);
    generator.invokeVirtual(componentType, getFontMethod);
    generator.storeLocal(fontLocal);

    generator.newInstance(ourFontType);
    generator.dup();
    if (descriptor.getFontName() != null) {
      generator.push(descriptor.getFontName());
    } else {
      generator.loadLocal(fontLocal);
      generator.invokeVirtual(ourFontType, ourGetNameMethod);
    }

    if (descriptor.getFontStyle() >= 0) {
      generator.push(descriptor.getFontStyle());
    } else {
      generator.loadLocal(fontLocal);
      generator.invokeVirtual(ourFontType, ourGetStyleMethod);
    }

    if (descriptor.getFontSize() >= 0) {
      generator.push(descriptor.getFontSize());
    } else {
      generator.loadLocal(fontLocal);
      generator.invokeVirtual(ourFontType, ourGetSizeMethod);
    }
    generator.invokeConstructor(ourFontType, ourInitMethod);
  }