Exemplo n.º 1
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   G e t M a g i c k H o m e U R L                                           %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  GetMagickHomeURL() returns the ImageMagick home URL.
%
%  The format of the GetMagickHomeURL method is:
%
%      char *GetMagickHomeURL(void)
%
*/
MagickExport char *GetMagickHomeURL(void)
{
  char
    path[MaxTextExtent];

  const char
    *element;

  ExceptionInfo
    *exception;

  LinkedListInfo
    *paths;

  exception=AcquireExceptionInfo();
  paths=GetConfigurePaths(MagickURLFilename,exception);
  exception=DestroyExceptionInfo(exception);
  if (paths == (LinkedListInfo *) NULL)
    return(ConstantString(MagickHomeURL));
  element=(const char *) GetNextValueInLinkedList(paths);
  while (element != (const char *) NULL)
  {
    (void) FormatMagickString(path,MaxTextExtent,"%s%s%s",element,
      DirectorySeparator,MagickURLFilename);
    if (IsAccessible(path) != MagickFalse)
      return(ConstantString(path));
    element=(const char *) GetNextValueInLinkedList(paths);
  }
  return(ConstantString(MagickHomeURL));
}
Exemplo n.º 2
0
void AIRayPathFinderStrategy::Route(Vector3 point)
{
	/*
	среди всех окружающих комнат получить те, которые пересекает
	направ. луч. перебрать объеты нашей комнаты и отобранных выше
	комнат на предмет пересечения их ббокса лучем. Среди всех
	этих объектов выбираем ближайший к нам: 
	а) постепенно наращивая луч, ждем первого пересечения с одним из выбранных выше объектов.
	б) находим точку пересечения с описанной вокруг ббокса сферой и определяем объект с ближайшей
	точкой

	для объекта выбираем вэйпойнт, ближайший к цели и видимый нам
	когда достигаем вэйпойнта, повторяем сначала	 
	*/

	//выбираем комнату, в которой находится наш центр (nose)


    IScenable *scen = Parent->GetScenable();
    assert(scen);

	Vector3 Position = scen->GetPosition();	
	Room *room=NULL;
	List<Room*> EdgeRooms;	

	Vector3 v, PreTargetPoint;	
	float HalfSide;
	IScenable *ClosestObj1=NULL;
	
	HalfSide = scen->GetBoundingBox().getSize().z/2; //test
	v=TargetPoint;
	v.normalise();
	
	Ogre::Ray line(Position,point);
	bool HaveIntersection=false;

    IRoomable *roomable = Parent->GetRoomable();
    assert(roomable);

	room = roomable->GetRoom(scen->GetPosition());

	if (NULL==room) {
		GoTo(point); // если мы за комнатами, препятствия не облетаем, нужно быстрее вернуться в комнаты.
        	//CommonDeclarations::GetRoomManager()->UpdateObject(Parent);
		//room = roomable->GetRoom(scen->GetPosition());

        //return;
		//assert(NULL!=room);
		return;
		/*
		char log[100];
		sprintf(log,"AI Path finder: A room not found\n");
		Debugging::Log("Warnings.log",log);
		descriptor->Throttle= Vector3(0,0,0);
		return;
		*/
	}

	// выбираем из окружающих комнат те, что пересекаются с нашим лучем (дорожкой)
	//if (!EdgeRooms.IsEmpty()) {
		EdgeRooms.Clear();
	//}
	Room *ActiveRoom = room->GetParentRoom();
	assert(ActiveRoom);
	if (NULL==ActiveRoom)
	{
		return;
	}
	ActiveRoom->GetEdgeRooms(room->GetRoomID(),EdgeRooms,line);

	EdgeRooms.PushBack(room);
	// перебираем объекты вблизи нашего пути, с которыми луч пересекается и ищем ближайший

	List<ObjZBuffer> ObjBuffer;
	ObjBuffer.Clear();

	GetIntersectionObjects(line, EdgeRooms, &ObjBuffer);

	// если путь свободен, движемся к ВП или к цели
	if (ObjBuffer.IsEmpty()) {		
#ifdef PATH_FINDER_DEBUG
		Debugging::Log("lines","intersection not found\n");
#endif
		//descriptor->Velocity= Vector3(0,0,0);
		//return;
		//break;
	} else
	{
		//std::vector<ObjZBuffer>::iterator iPosZ=ObjBuffer.begin(), iEndZ=ObjBuffer.end();
		long long SmallestDist=10000000;			

		for (List<ObjZBuffer>::ListNode *pos=ObjBuffer.GetBegin();pos!=NULL;pos=pos->Next)
		{
			if (pos->Value.distance<SmallestDist)
			{
				SmallestDist=pos->Value.distance;
				ClosestObj=pos->Value.object;
			}
		}

		// если какой-то объект преграждает путь, идем по ВП, предварительно проверив
		// путь для нового направления (чтобы он был свободным).
		// если путь свободен, идем к точке с нашей скоростью

		
		if (NULL!=ClosestObj) 
		{
			IScriptable *scr = ClosestObj->GetScriptable();
			IScenable *closest_scen = ClosestObj->GetScenable();
			if (scr==NULL || scr->GetID()!=TargetID)
			{
				// выбираем для объекта все видимые нам ВП				

				SmallestDist=10000000;
				long long dist;

				ClosestObj1 = closest_scen;

				{
					Vector3 BoundingPoints[8];
					closest_scen->GetBoundingPoints(2*HalfSide, BoundingPoints);					

					for (int i=0;i<8;++i)
					{
						line.setOrigin(Position);
						line.setDirection(BoundingPoints[i]);

						if (IsAccessible(line, EdgeRooms))
						{
							dist=(point-line.getDirection()).squaredLength();
							if (dist<SmallestDist)
							{	
								HaveIntersection=true;
								SmallestDist=dist;								
								PreTargetPoint=BoundingPoints[i];								
#ifdef PATH_FINDER_DEBUG
								Debugging::Log("lines","dist looking...\n");
#endif
							}
						}
					}	
				}
			} else
			{
				
#ifdef PATH_FINDER_DEBUG
					Debugging::Log("Warnings.log","closest object not found\n");
#endif
					//Parent->GetPhysical()->SetForwardDirection(Vector3(0,0,0));
					//return;				
			}
			
		} else
		{			
			if (NULL==ClosestObj)
			{
				#ifdef PATH_FINDER_DEBUG
				Debugging::Log("Warnings.log","closest object not found\n");
				#endif
				Parent->GetPhysical()->SetForwardDirection(Vector3(0,0,0));
				return;
			}								
		}
	}

	if (!HaveIntersection && ClosestObj1)
	{
		#ifdef PATH_FINDER_DEBUG
		Debugging::Log("Warnings.log","access to closest object not found\n");
		#endif
		Parent->GetPhysical()->SetForwardDirection(Vector3(0,0,0));
		return;
	}

	Vector3 vr;
	if (HaveIntersection) 
	{			
		HaveCashedTarget = true;
		CashedTargetPoint = PreTargetPoint;


		//vr=Position-CashedTargetPoint;	
		GoTo(CashedTargetPoint);
	} else	
	{		
		//vr=Position-point;
		GoTo(point);
	}

/*	Vector3 AccelerationOn(Vector3::ZERO); // = Parent->GetAccelerationOn();
    IPhysical *phys = Parent->GetPhysical();
    assert(phys);

	{
		vr.normalise();
		phys->SetForwardDirection(vr);		
		AccelerationOn.z=-1;
		//phys->SetVelocityVector(vr);
	}
	phys->SetAcceleration(AccelerationOn);
*/

#ifdef PATH_FINDER_DEBUG
	if (HaveCashedTarget) 
	{
		char log[200];
		sprintf(log, "%d going to WP (%f,%f,%f)\n",Parent->GetScriptable()->GetID(),CashedTargetPoint.x, CashedTargetPoint.y, CashedTargetPoint.z);
		Debugging::Log("lines",log);	
	} else
	{
		char log[200];
		sprintf(log, "%d going to TARGET (%f,%f,%f)\n",Parent->GetScriptable()->GetID(),point.x, point.y, point.z);
		Debugging::Log("lines",log);	
		//Debugging::Log("lines","going to TARGET\n");		
	}
#endif

}
Exemplo n.º 3
0
BCSYM_Variable*
Bindable::BindWithEventsVariable
(
    _In_z_ STRING *WithEventVarName,
    bool &InAccessible,
    bool &WithEventsVarFoundInBase
)
{
    InAccessible = false;
    WithEventsVarFoundInBase = false;

    VSASSERT( CurrentContainer()->IsClass(), "How can a non-class have handles clauses ?");

    BCSYM_Class *Class = CurrentContainer()->PClass();
    bool IsShadowed = false;

    BCSYM_NamedRoot *Member;
    for(Member = Class->SimpleBind(NULL, WithEventVarName);
        Member;
        Member = Member->GetNextOfSameName())
    {
        if (Member->IsVariable() &&
            Member->PVariable()->GetVarkind() == VAR_WithEvents)
        {
            return Member->PVariable();
        }

        // Ignore synthesized properties in checking for shadowing.

        if (!Member->CreatedByWithEventsDecl() || !Member->IsProperty())
        {
            IsShadowed = true;
        }
    }


    for(BCSYM_Class *Base = Class->GetCompilerBaseClass();
        !IsShadowed && Base;
        Base = Base->GetCompilerBaseClass())
    {
        for(Member = Base->SimpleBind(NULL, WithEventVarName);
            Member;
            Member = Member->GetNextOfSameName())
        {
            if (Member->IsVariable() &&
                Member->PVariable()->GetVarkind() == VAR_WithEvents)
            {
                if (IsAccessible(Member))
                {
                    WithEventsVarFoundInBase = true;
                    return Member->PVariable();
                }

                InAccessible = true;
            }
            else
            {
                if (IsAccessible(Member) &&
                    // Ignore synthesized properties in checking for shadowing.
                    (!Member->CreatedByWithEventsDecl() || !Member->IsProperty()))
                {
                    IsShadowed = true;
                }
            }
        }
    }

    return NULL;
}
Exemplo n.º 4
0
bool
Bindable::CheckForAccessibleEventsWorker
(
    BCSYM *TypePossiblyContainingEvents,
    BCSYM *TypeOfWithEventsVar,
    MembersHashTable *ShadowingMembers,
    bool ConsiderEventSourcePropertiesToo,
    bool &AnyEventDefined
)
{
    VSASSERT( TypePossiblyContainingEvents->IsContainer(),
                    "Looking for events in non-container unexpected!!!");

    // 


    // ---- attributes on all symbols in the EventDecl container. This is needed
    // in order to verify if a property is an EventSource which is determined by
    // an attribute on the property.
    //
    if (ConsiderEventSourcePropertiesToo)
    {
        ----AttributesOnAllSymbolsInContainer(TypePossiblyContainingEvents->PContainer(), m_CompilationCaches);
    }

    BCITER_CHILD ContainerIterator;
    ContainerIterator.Init(TypePossiblyContainingEvents->PContainer());

    for(BCSYM_NamedRoot *EventDecl = ContainerIterator.GetNext();
        EventDecl != NULL;
        EventDecl = ContainerIterator.GetNext())
    {
        // Was the event decl we just found shadowed out by somebody on a nearer base class/interface?
        //
        if (IsMemberShadowed(EventDecl, ShadowingMembers))
            continue;

        bool IsMemberAccessible =
            IsAccessible(
                EventDecl,
                TypePossiblyContainingEvents->IsGenericBinding() ?
                    TypePossiblyContainingEvents->PGenericBinding() :
                    NULL,
                CurrentContainer(),
                TypeOfWithEventsVar);

        // Keep track of who is shadowing in this container - we'll need the info if the event we find is on a derived container
        if (IsMemberAccessible && EventDecl->IsShadowing())
        {
            ShadowingMembers->Add(EventDecl);
        }

        if (ConsiderEventSourcePropertiesToo &&
            EventDecl->IsProperty() &&
            ValidEventSourceProperty(EventDecl->PProperty()))
        {
            IsMemberAccessible =
                IsMemberAccessible &&
                IsAccessible(
                    EventDecl->PProperty()->GetProperty(),
                    TypePossiblyContainingEvents->IsGenericBinding() ?
                        TypePossiblyContainingEvents->PGenericBinding() :
                        NULL,
                    CurrentContainer(),
                    TypeOfWithEventsVar);

            BCSYM *PropertyReturnType = EventDecl->PProperty()->GetType();

            // 


            // We only care about properties returning classes or interfaces
            // because only classes and interfaces can be specified in a
            // handles clause.
            //

            VSASSERT(IsClassOrInterface(PropertyReturnType),
                        "Invalid event source property found. Should have been disallowed earlier!!!");

            // We've come across a Property that returns an Event source.  Dig through it.
            //
            if (CheckForAccessibleEvents(
                    PropertyReturnType,                // Property return type
                    false,                             // i.e. don't consider EventSource properties, because
                                                       //    we only allow at most 3 names i.e. x.y.z in the
                                                       //    handles clause and and only y is allowed to be the
                                                       //    referring event source property.
                    AnyEventDefined))
            {
                // there are events on this WithEvents variable - and they are accessible
            }
            else
            {
                continue;
            }
        }
        else if (EventDecl->IsEventDecl())
        {
            // there are events on this WithEvents variable - whether they are accessible is another matter
            //
            AnyEventDefined = true;
        }
        else
        {
            // Screen out everthing that isn't an Event declaration or possible Event Source
            //
            continue;
        }

        // This assert will guard against any bad changes to the conditions checks above
        VSASSERT( AnyEventDefined,
                        "How can we get here when we have not found any event or event source ?");

        // Determine if the event is accessible
        // It must be visible to the WithEvents container that references the event
        //
        if (IsMemberAccessible)
        {
            return true;
        }

    } // trawl container members looking for events/properties that may return events


    // Look recursively in bases too
    BasesIter Bases(TypePossiblyContainingEvents->PContainer());

    BCSYM_GenericTypeBinding *BaseGenericBinding;
    while (BCSYM_Container *Base = Bases.GetNextBase(&BaseGenericBinding))
    {
        if (Base->IsBad()) continue;

        if (CheckForAccessibleEventsWorker(
                BaseGenericBinding ?
                    (BCSYM *)BaseGenericBinding :
                    Base,
                TypeOfWithEventsVar,
                ShadowingMembers,
                false,  // Don't consider event source properties in based as available
                        // because we don't allow binding to them in the handles clause
                        // (for no other better reason than leaving this implementation
                        //  as it was without complicating things, since this is not a
                        //  user feature anyway.)
                AnyEventDefined))
        {
            return true;
        }
    }

    return false; // no visible events found
}
Exemplo n.º 5
0
BCSYM_Property*
Bindable::GetEventSourceProperty
(
    BCSYM *TypeOfWithEventsVar,
    _In_z_ STRING *PropertyName
)
{
    // Need to find a property that sources an event

    // To handle events on subobjects, (internal use only), you must supply a Class
    // type for the WithEvents variable. But for completeness with respect to generics,
    // adding support type parameters with class constraints too.

    BCSYM *TypeToFindEventSourcePropertyIn;

    if (TypeOfWithEventsVar->IsGenericParam())
    {
        // 
        TypeToFindEventSourcePropertyIn =
            GetClassConstraint(
                TypeOfWithEventsVar->PGenericParam(),
                CurrentCompilerHost(),
                CurrentAllocator(),
                false, // don't ReturnArraysAs"System.Array"
                true   // ReturnValuesAs"System.ValueType"or"System.Enum"
                );
    }
    else
    {
        TypeToFindEventSourcePropertyIn = TypeOfWithEventsVar;
    }

    if (!TypeToFindEventSourcePropertyIn ||
        !TypeToFindEventSourcePropertyIn->IsClass())
    {
        return NULL;
    }

    // ---- attributes on all symbols in the TypeOfWithEventsVar container. This is needed
    // in order to verify if a property is an EventSource which is determined by
    // an attribute on the property.
    //
    ----AttributesOnAllSymbolsInContainer(TypeToFindEventSourcePropertyIn->PClass(), m_CompilationCaches);

    BCSYM_NamedRoot *Property =
        TypeToFindEventSourcePropertyIn->PClass()->SimpleBind(NULL, PropertyName);

    while (Property && Property->IsProperty())
    {
        if (ValidEventSourceProperty(Property->PProperty()) &&
            IsAccessible(
                Property->PProperty()->GetProperty(),
                TypeToFindEventSourcePropertyIn->IsGenericBinding() ?
                    TypeToFindEventSourcePropertyIn->PGenericBinding() :
                    NULL,
                CurrentContainer(),
                TypeOfWithEventsVar))
        {
            return Property->PProperty(); // found it
        }

        Property = Property->GetNextOfSameName();

        // Note:
        // - we don't support finding the Property if it is overloaded
        // across classes.
        // - Also note that we don't support digging into bases. This was
        // how the previous impl. was.
        // Given that this is not a user feature, we don't bother doing
        // this extra work.

    }

    return NULL;
}
Exemplo n.º 6
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   R e a d M P E G I m a g e                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  ReadMPEGImage() reads an binary file in the MPEG video stream format
%  and returns it.  It allocates the memory necessary for the new Image
%  structure and returns a pointer to the new image.  This method differs from
%  the other decoder methods in that only the Photoshop resource (MPEG)
%  information is useful in the returned image.
%
%  The format of the ReadMPEGImage method is:
%
%      Image *ReadMPEGImage(const ImageInfo *image_info,
%        ExceptionInfo *exception)
%
%  A description of each parameter follows:
%
%    o image_info: The image info.
%
%    o exception: return any errors or warnings in this structure.
%
%
*/
static Image *ReadMPEGImage(const ImageInfo *image_info,
  ExceptionInfo *exception)
{
  Image
    *image,
    *images;

  ImageInfo
    *read_info;

  MagickBooleanType
    status;

  register long
    i;

  /*
    Open image file.
  */
  assert(image_info != (const ImageInfo *) NULL);
  assert(image_info->signature == MagickSignature);
  if (image_info->debug != MagickFalse)
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
      image_info->filename);
  assert(exception != (ExceptionInfo *) NULL);
  assert(exception->signature == MagickSignature);
  image=AllocateImage(image_info);
  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
  if (status == MagickFalse)
    {
      image=DestroyImageList(image);
      return((Image *) NULL);
    }
  CloseBlob(image);
  DestroyImageList(image);
  /*
    Convert MPEG to PPM with delegate.
  */
  image=AllocateImage(image_info);
  read_info=CloneImageInfo(image_info);
  (void) InvokeDelegate(read_info,image,"mpeg-decode",(char *) NULL,exception);
  image=DestroyImage(image);
  /*
    Read PPM files.
  */
  images=NewImageList();
  for (i=(long) read_info->scene; ; i++)
  {
    (void) FormatMagickString(read_info->filename,MaxTextExtent,
      "%s%ld.ppm",read_info->unique,i);
    if (IsAccessible(read_info->filename) == MagickFalse)
      break;
    image=ReadImage(read_info,exception);
    if (image == (Image *) NULL)
      break;
    (void) strcpy(image->magick,image_info->magick);
    image->scene=(unsigned long) i;
    AppendImageToList(&images,image);
    if (read_info->number_scenes != 0)
      if (i >= (long) (read_info->scene+read_info->number_scenes-1))
        break;
  }
  /*
    Free resources.
  */
  for (i=0; ; i++)
  {
    (void) FormatMagickString(read_info->filename,MaxTextExtent,
      "%s%ld.ppm",read_info->unique,i);
    if (IsAccessible(read_info->filename) == MagickFalse)
      break;
    (void) remove(read_info->filename);
  }
  read_info=DestroyImageInfo(read_info);
  return(images);
}
Exemplo n.º 7
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
+   N T G e t T y pe L i s t                                                  %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  NTLoadTypeLists() loads a Windows TrueType fonts.
%
%  The format of the NTLoadTypeLists method is:
%
%      MagickBooleanType NTLoadTypeLists(SplayTreeInfo *type_list)
%
%  A description of each parameter follows:
%
%    o type_list: A linked list of fonts.
%
*/
MagickExport MagickBooleanType NTLoadTypeLists(SplayTreeInfo *type_list,
  ExceptionInfo *exception)
{
  HKEY
    reg_key = (HKEY) INVALID_HANDLE_VALUE;

  LONG
    res;


  int
    list_entries = 0;

  char
    buffer[MaxTextExtent],
    system_root[MaxTextExtent],
    font_root[MaxTextExtent];

  DWORD
    type,
    system_root_length;

  MagickBooleanType
    status;

  /*
    Try to find the right Windows*\CurrentVersion key, the SystemRoot and
    then the Fonts key
  */
  res = RegOpenKeyExA (HKEY_LOCAL_MACHINE,
    "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &reg_key);
  if (res == ERROR_SUCCESS) {
    system_root_length=sizeof(system_root)-1;
    res = RegQueryValueExA(reg_key,"SystemRoot",NULL, &type,
      (BYTE*) system_root, &system_root_length);
  }
  if (res != ERROR_SUCCESS) {
    res = RegOpenKeyExA (HKEY_LOCAL_MACHINE,
      "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0, KEY_READ, &reg_key);
    if (res == ERROR_SUCCESS) {
      system_root_length=sizeof(system_root)-1;
      res = RegQueryValueExA(reg_key,"SystemRoot",NULL, &type,
        (BYTE*)system_root, &system_root_length);
    }
  }
  if (res == ERROR_SUCCESS)
    res = RegOpenKeyExA (reg_key, "Fonts",0, KEY_READ, &reg_key);
  if (res != ERROR_SUCCESS)
    return(MagickFalse);
  *font_root='\0';
  (void) CopyMagickString(buffer,system_root,MaxTextExtent);
  (void) ConcatenateMagickString(buffer,"\\fonts\\arial.ttf",MaxTextExtent);
  if (IsAccessible(buffer) != MagickFalse)
    {
      (void) CopyMagickString(font_root,system_root,MaxTextExtent);
      (void) ConcatenateMagickString(font_root,"\\fonts\\",MaxTextExtent);
    }
  else
    {
      (void) CopyMagickString(font_root,system_root,MaxTextExtent);
      (void) ConcatenateMagickString(font_root,"\\",MaxTextExtent);
    }

  {
    TypeInfo
      *type_info;

    DWORD
      registry_index = 0,
      type,
      value_data_size,
      value_name_length;

    char
      value_data[MaxTextExtent],
      value_name[MaxTextExtent];

    res = ERROR_SUCCESS;

    while (res != ERROR_NO_MORE_ITEMS)
      {
        char
          *family_extent,
          token[MaxTextExtent],
          *pos,
          *q;

        value_name_length = sizeof(value_name) - 1;
        value_data_size = sizeof(value_data) - 1;
        res = RegEnumValueA ( reg_key, registry_index, value_name,
          &value_name_length, 0, &type, (BYTE*)value_data, &value_data_size);
        registry_index++;
        if (res != ERROR_SUCCESS)
          continue;
        if ( (pos = strstr(value_name, " (TrueType)")) == (char*) NULL )
          continue;
        *pos='\0'; /* Remove (TrueType) from string */

        type_info=(TypeInfo *) AcquireMagickMemory(sizeof(*type_info));
        if (type_info == (TypeInfo *) NULL)
          ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
        (void) ResetMagickMemory(type_info,0,sizeof(TypeInfo));

        type_info->path=ConstantString("Windows Fonts");
        type_info->signature=MagickSignature;

        /* Name */
        (void) CopyMagickString(buffer,value_name,MaxTextExtent);
        for(pos = buffer; *pos != 0 ; pos++)
          if (*pos == ' ')
            *pos = '-';
        type_info->name=ConstantString(buffer);

        /* Fullname */
        type_info->description=ConstantString(value_name);

        /* Format */
        type_info->format=ConstantString("truetype");

        /* Glyphs */
        if (strchr(value_data,'\\') != (char *) NULL)
          (void) CopyMagickString(buffer,value_data,MaxTextExtent);
        else
          {
            (void) CopyMagickString(buffer,font_root,MaxTextExtent);
            (void) ConcatenateMagickString(buffer,value_data,MaxTextExtent);
          }

        LocaleLower(buffer);
        type_info->glyphs=ConstantString(buffer);

        type_info->stretch=NormalStretch;
        type_info->style=NormalStyle;
        type_info->weight=400;

        /* Some fonts are known to require special encodings */
        if ( (LocaleCompare(type_info->name, "Symbol") == 0 ) ||
             (LocaleCompare(type_info->name, "Wingdings") == 0 ) ||
             (LocaleCompare(type_info->name, "Wingdings-2") == 0 ) ||
             (LocaleCompare(type_info->name, "Wingdings-3") == 0 ) )
          type_info->encoding=ConstantString("AppleRoman");

        family_extent=value_name;

        for (q=value_name; *q != '\0'; )
          {
            GetMagickToken(q,&q,token);
            if (*token == '\0')
              break;

            if (LocaleCompare(token,"Italic") == 0)
              {
                type_info->style=ItalicStyle;
              }

            else if (LocaleCompare(token,"Oblique") == 0)
              {
                type_info->style=ObliqueStyle;
              }

            else if (LocaleCompare(token,"Bold") == 0)
              {
                type_info->weight=700;
              }

            else if (LocaleCompare(token,"Thin") == 0)
              {
                type_info->weight=100;
              }

            else if ( (LocaleCompare(token,"ExtraLight") == 0) ||
                      (LocaleCompare(token,"UltraLight") == 0) )
              {
                type_info->weight=200;
              }

            else if (LocaleCompare(token,"Light") == 0)
              {
                type_info->weight=300;
              }

            else if ( (LocaleCompare(token,"Normal") == 0) ||
                      (LocaleCompare(token,"Regular") == 0) )
              {
                type_info->weight=400;
              }

            else if (LocaleCompare(token,"Medium") == 0)
              {
                type_info->weight=500;
              }

            else if ( (LocaleCompare(token,"SemiBold") == 0) ||
                      (LocaleCompare(token,"DemiBold") == 0) )
              {
                type_info->weight=600;
              }

            else if ( (LocaleCompare(token,"ExtraBold") == 0) ||
                      (LocaleCompare(token,"UltraBold") == 0) )
              {
                type_info->weight=800;
              }

            else if ( (LocaleCompare(token,"Heavy") == 0) ||
                      (LocaleCompare(token,"Black") == 0) )
              {
                type_info->weight=900;
              }

            else if (LocaleCompare(token,"Condensed") == 0)
              {
                type_info->stretch = CondensedStretch;
              }

            else if (LocaleCompare(token,"Expanded") == 0)
              {
                type_info->stretch = ExpandedStretch;
              }

            else if (LocaleCompare(token,"ExtraCondensed") == 0)
              {
                type_info->stretch = ExtraCondensedStretch;
              }

            else if (LocaleCompare(token,"ExtraExpanded") == 0)
              {
                type_info->stretch = ExtraExpandedStretch;
              }

            else if (LocaleCompare(token,"SemiCondensed") == 0)
              {
                type_info->stretch = SemiCondensedStretch;
              }

            else if (LocaleCompare(token,"SemiExpanded") == 0)
              {
                type_info->stretch = SemiExpandedStretch;
              }

            else if (LocaleCompare(token,"UltraCondensed") == 0)
              {
                type_info->stretch = UltraCondensedStretch;
              }

            else if (LocaleCompare(token,"UltraExpanded") == 0)
              {
                type_info->stretch = UltraExpandedStretch;
              }

            else
              {
                family_extent=q;
              }
          }

        (void) CopyMagickString(buffer,value_name,family_extent-value_name+1);
        StripString(buffer);
        type_info->family=ConstantString(buffer);

        list_entries++;
        status=AddValueToSplayTree(type_list,ConstantString(type_info->name),
          type_info);
        if (status == MagickFalse)
          (void) ThrowMagickException(exception,GetMagickModule(),
            ResourceLimitError,"MemoryAllocationFailed","`%s'",type_info->name);
      }
  }
  RegCloseKey ( reg_key );
  return(MagickTrue);
}