some questions

Everything else that doesn't fall into one of the other PB categories.
fraalg
New User
New User
Posts: 3
Joined: Tue Aug 28, 2007 12:39 pm
Location: italia

some questions

Post by fraalg »

hello everybody.

i'm using PB from 1 year (registred one) and i'm very happy to see a very helpful, nice community around PB.

i have some questions :

1/ i'll try to use uniscribe for one of my projects and i have a problem to use the ScriptItemize() function. see the code
i'm using the lib provided with pb.
the wrapper (incomplete)

Code: Select all

; -------------------------------------------------------
;                   Uniscribe wrapper
; -------------------------------------------------------


; -------------------------------------------------------
;                      enumerations
;[ ------------------------------------------------------

  Enumeration ;SCRIPT_JUSTIFY
   #SCRIPT_JUSTIFY_NONE 
   #SCRIPT_JUSTIFY_ARABIC_BLANK 
   #SCRIPT_JUSTIFY_CHARACTER
   #SCRIPT_JUSTIFY_RESERVED1 
   #SCRIPT_JUSTIFY_BLANK 
   #SCRIPT_JUSTIFY_RESERVED2
   #SCRIPT_JUSTIFY_RESERVED3
   #SCRIPT_JUSTIFY_ARABIC_NORMAL
   #SCRIPT_JUSTIFY_ARABIC_KASHIDA  
   #SCRIPT_JUSTIFY_ARABIC_ALEF
   #SCRIPT_JUSTIFY_ARABIC_HA 
   #SCRIPT_JUSTIFY_ARABIC_RA 
   #SCRIPT_JUSTIFY_ARABIC_BA 
   #SCRIPT_JUSTIFY_ARABIC_BARA 
   #SCRIPT_JUSTIFY_ARABIC_SEEN 
   #SCRIPT_JUSTIFY_ARABIC_SEEN_M 
  EndEnumeration

;   #SGCM_RTL  =  $00000001
  #SSA_PASSWORD =  $00000001
  #SSA_TAB  =  $00000002
  #SSA_CLIP =   $00000004
  #SSA_FIT   = $00000008
  #SSA_DZWG  = $00000010
  #SSA_FALLBACK =  $00000020
  #SSA_BREAK  = $00000040
  #SSA_GLYPHS =  $00000080
  #SSA_RTL =  $00000100
  #SSA_GCP =  $00000200
  #SSA_HOTKEY =  $00000400
  #SSA_METAFILE =  $00000800
  #SSA_LINK  = $00001000
  #SSA_HIDEHOTKEY  = $00002000
  #SSA_HOTKEYONLY  = $00002400
  #SSA_FULLMEASURE =  $04000000
  #SSA_LPKANSIFALLBACK =  $08000000
  #SSA_PIDX =  $10000000
  #SSA_LAYOUTRTL =  $20000000
  #SSA_DONTGLYPH =  $40000000
  #SSA_NOKASHIDA =  $80000000
  #SIC_COMPLEX  = 1
  #SIC_ASCIIDIGIT =  2
  #SIC_NEUTRAL  = 4
  #SCRIPT_DIGITSUBSTITUTE_CONTEXT =  0
  #SCRIPT_DIGITSUBSTITUTE_NONE  = 1
  #SCRIPT_DIGITSUBSTITUTE_NATIONAL  = 2
  #SCRIPT_DIGITSUBSTITUTE_TRADITIONAL  = 3
  
;] ------------------------------------------------------

; -------------------------------------------------------
;                      structures
;[ ------------------------------------------------------

  Structure SCRIPT_CONTROL
  uDefaultLanguage.l; :16; 
  fContextDigits.l; :1; 
  fInvertPreBoundDir.l; :1; 
  fInvertPostBoundDir.l; :1; 
  fLinkStringBefore.l; :1; 
  fLinkStringAfter.l; :1; 
  fNeutralOverride.l;:1; 
  fNumericOverride.l; :1; 
  fLegacyBidiClass.l; :1; 
  fReserved.l; :8;   
  EndStructure 

  Structure SCRIPT_STATE 
  uBidiLevel.l; :5; 
  fOverrideDirection.l; :1; 
  fInhibitSymSwap.l; :1; 
  fCharShape.l; :1; 
  fDigitSubstitute.l; :1; 
  fInhibitLigate.l; :1; 
  fDisplayZWG.l; :1; 
  fArabicNumContext.l; :1; 
  fGcpClusters.l; :1; 
  fReserved.l; :1; 
  fEngineReserved.l; :2; 
  EndStructure 

  Structure SCRIPT_TABDEF 
  cTabStops.l
  iScale.l
  *pTabStops.l
  iTabOrigin.l
  EndStructure 

  Structure OPENTYPE_FEATURE_RECORD
  tagFeature.l
  lParameter.l  
  EndStructure 
  
  Structure SCRIPT_ANALYSIS
  eScript.w      ;:10; 
  fRTL.w         ; :1; 
  fLayoutRTL.w   ; :1; 
  fLinkBefore.w  ; :1; 
  fLinkAfter.w   ; :1; 
  fLogicalOrder.w; :1; 
  fNoGlyphIndex.w; :1; 
  s.SCRIPT_STATE  
  EndStructure 
  
  Structure SCRIPT_CHARPROP
  fCanGlyphAlone.l ; : 1;
  reserved.l       ;: 15; 
  EndStructure 
  
  Structure SCRIPT_DIGITSUBSTITUTE
  NationalDigitLanguage.l;    : 16;
  TraditionalDigitLanguage.l ;: 16;
  DigitSubstitute.l;          :8;
  dwReserved.l
  EndStructure 
  
  Structure SCRIPT_FONTPROPERTIES
  cBytes.l 
  wgBlank.w
  wgDefault.w 
  wgInvalid.w
  wgKashida.w
  iKashidaWidth.l
  EndStructure 
  
  Structure SCRIPT_VISATTR
  uJustification.w; :4; 
  fClusterStart.w; :1; 
  fDiacritic.w; :1; 
  fZeroWidth.w; :1; 
  fReserved.w; :1; 
  fShapeReserved.w; :8; 
  EndStructure 
  
  Structure SCRIPT_GLYPHPROP
  sva.SCRIPT_VISATTR
  reserved.w
  EndStructure 

  Structure SCRIPT_ITEM
  iCharPos.l
  a.SCRIPT_ANALYSIS
  EndStructure 

  Structure SCRIPT_LOGATTR
  fSoftBreak.b; :1; 
  fWhiteSpace.b; :1; 
  fCharStop.b; :1; 
  fWordStop.b; :1; 
  fInvalid.b; :1; 
  fReserved.b; :3; 
  EndStructure

  Structure SCRIPT_PROPERTIES
  langid.l;              :16;  
  fNumeric.l;            :1;
  fComplex.l;            :1;
  fNeedsWordBreaking.l;  :1;   
  fNeedsCaretInfo.l;     :1;
  bCharSet.l;            :8;   
  fControl.l;            :1;   
  fPrivateUseArea.l;     :1;   
  fNeedsCharacterJustify.l; :1;
  fInvalidGlyph.l;       :1;
  fInvalidLogAttr.l;     :1;
  fCDM.l;               :1;
  fAmbiguousCharSet.l;   :1;
  fClusterSizeVaries.l;  :1;
  fRejectInvalid.l;      ;1;
  EndStructure 

  Structure TEXTRANGE_PROPERTIES
  *potfRecords.OPENTYPE_FEATURE_RECORD
  cotfRecords.l
  EndStructure 

  Structure GOFFSET
  du.l
  dv.l
  EndStructure 
  
;] ------------------------------------------------------

; -------------------------------------------------------
;                       import    
;[ ------------------------------------------------------
  Import "usp10.lib"
  ScriptStringAnalyse.l(hdc.l,*texte.s,cString.l,cGlyphs.l,iCharset.l,dwFlags.w,iReqWidth.l,*sc.SCRIPT_CONTROL, *psState.SCRIPT_STATE, *piDx.l, *pTabdef.SCRIPT_TABDEF, *pbInClass.b, *pssa.l)
  ScriptStringFree.l(*pssa)
  ScriptStringOut.l(*ssa.l, iX.l,iY.l,uOptions.l,*prc.RECT,iMinSel.l,iMaxSel.l,fDisabled.l) 
  ScriptXtoCP.l(iX.l,cChars.l,cGlyphs.l,*pwLogClust.w,*psva.SCRIPT_VISATTR,*piAdvance.l,*psa.SCRIPT_ANALYSIS,*piCP.l,*piTrailing.l) 
  ScriptTextOut.l(hdc.l,*psc.l,x.l,y.l,fuOptions.l,*lprc.RECT,*psa.SCRIPT_ANALYSIS,*pwcReserved.w,iReserved.l,*pwGlyphs.w,cGlyphs.l,*piAdvance.l,*piJustify.l,*pGoffset.GOFFSET)
  ScriptSubstituteSingleGlyph.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,tagScript.l,tagLangSys.l,tagFeature.l,lParameter.l,wGlyphId.w,*pwOutGlyphId.w)  
  ScriptStringXtoCP.l(*ssa.l,iX.l,*piCh.l,*piTrailing.l)
  ScriptStringValidate.l(*ssa.l) 
  ScriptString_pSize.l(*ssa.l)
  ScriptString_pLogAttr.l(*ssa.l)
  ScriptString_pcOutChars.l(*ssa.l)    
  ScriptStringGetOrder.l(*ssa.l,*puOrder.l) 
  ScriptStringGetLogicalWidths.l(*ssa.l,*piDx.l)
  ScriptStringCPtoX(*ssa.l,icp.l,fTrailing.l,*pX.l)
  ScriptShapeOpenType.l(hdc.l,*psc.l, *psa.SCRIPT_ANALYSIS,tagScript.l,tagLangSys.l,*rcRangeChars.l,*rpRangeProperties.TEXTRANGE_PROPERTIES,cRanges.l,*pwcChars.w,cChars.l,cMaxGlyphs.l,*pwLogClust.w,*pCharProps.SCRIPT_CHARPROP,*pwOutGlyphs.w,*pOutGlyphProps.SCRIPT_GLYPHPROP,*pcGlyphs.l)  
  ScriptShape.l(hdc.l,*psc.l,*pwcChars.w,cChars.l,cMaxGlyphs.l,*psa.SCRIPT_ANALYSIS, *pwOutGlyphs.w,*pwLogClust.w,*psva.SCRIPT_VISATTR,*pcGlyphs.l)
  ScriptRecordDigitSubstitution.l(Locale.l,*psds.SCRIPT_DIGITSUBSTITUTE)
  ScriptPositionSingleGlyph.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,tagScript.l,tagLangSys.l,tagFeature.l,lParameter.l,wGlyphId.w,iAdvance.l,*gOffset.GOFFSET,*piOutAdvance.l,*pOutGoffset.GOFFSET)
  ScriptPlaceOpenType.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,tagScript.l,tagLangSys.l,*rcRangeChars.l,*rpRangeProperties.TEXTRANGE_PROPERTIES,cRanges.l,*pwcChars.w,*pwLogClust.w,*pCharProps.SCRIPT_CHARPROP,cChars.l,*pwGlyphs.w,*pGlyphProps.SCRIPT_GLYPHPROP,cGlyphs.l,*piAdvance.l,*pGoffset.GOFFSET,*pABC.ABC)
  ScriptPlace.l(hdc.l,*psc.l,*pwGlyphs.w,cGlyphs.l,*psva.SCRIPT_VISATTR,*psa.SCRIPT_ANALYSIS,*piAdvance.l,*pGoffset.GOFFSET,*pABC.ABC) 
  ScriptLayout.l(cRuns.l,*pbLevel.b,*piVisualToLogical.l,*piLogicalToVisual.l)
  ScriptJustify.l(*psva.SCRIPT_VISATTR,*piAdvance.l,cGlyphs.l,iDx.l,iMinKashida.l,*piJustify.l)
  ScriptItemizeOpenType.l(*pwcInChars.w,cInChars.l,cMaxItems.l,*psControl.SCRIPT_CONTROL,*psState.SCRIPT_STATE,*pItems.SCRIPT_ITEM,*pScriptTags.l,*pcItems.l)
  ScriptItemize.l(*pwcInChars.s,cInChars.l,cMaxItems.l,*psControl.SCRIPT_CONTROL,*psState.SCRIPT_STATE,*pItems.SCRIPT_ITEM,*pcItems.l) 
  ScriptIsComplex.l(*pwcInChars.w,cInChars.l,dwFlags.l)
  ScriptGetProperties.l(*ppSp.SCRIPT_PROPERTIES,*piNumScripts.l)
  ScriptGetLogicalWidths.l(*psa.SCRIPT_ANALYSIS,cChars.l,cGlyphs.l,*piGlyphWidth.l,*pwLogClust.w,*psva.SCRIPT_VISATTR,*piDx.l)
  ScriptGetGlyphABCWidth.l(hdc.l,*psc.l,wGlyph.w,*pABC.ABC)
  ScriptGetFontScriptTags.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,cMaxTags.l,*pScriptTags.l,*pcTags.l)
  ScriptGetFontProperties.l(hdc.l,*psc.l,*sfp.SCRIPT_FONTPROPERTIES)
  ScriptGetFontLanguageTags.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,tagScript.l,cMaxTags.l,*pLangSysTags.l,*pcTags.l)   
  ScriptGetFontFeatureTags.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,tagScript.l,tagLangSys.l,cMaxTags.l,*pFeatureTags.l,*pcTags.l) 
  ScriptGetFontAlternateGlyphs.l(hdc.l,*psc.l,*psa.SCRIPT_ANALYSIS,tagScript.l,tagLangSys.l,tagFeature.l,wGlyph.w,cMaxAlternates.l,*pAlternateGlyphs.w,*pcAlternates.l)
  ScriptGetCMap.l(hdc.l,*psc.l,*pwcInChars.w,cChars.l,dwFlags.l,*pwOutGlyphs.w)
  ScriptFreeCache.l(*psc.l)
  ScriptCPtoX.l(iCP.l,fTrailing.l,cChars.l,cGlyphs.l,*pwLogClust.w,*psva.SCRIPT_VISATTR,*piAdvance.l,*psa.SCRIPT_ANALYSIS,*piX.l)   
  ScriptCacheGetHeight.l(hdc.l,*psc.l,*tmHeight.l)
  ScriptBreak.l(*pwcChars.w,cChars.l,*psa.SCRIPT_ANALYSIS,*psla.SCRIPT_LOGATTR)
  ScriptApplyLogicalWidth.l(*piDx.l,cChars.l,cGlyphs.l,*pwLogClust.w,*psva.SCRIPT_VISATTR,*piAdvance.l,*psa.SCRIPT_ANALYSIS,*pABC.ABC,*piJustify.l)
  ScriptApplyDigitSubstitution.l(*psds.SCRIPT_DIGITSUBSTITUTE,*psc.SCRIPT_CONTROL,*pss.SCRIPT_STATE)
  EndImport 
;] ------------------------------------------------------


; -------------------------------------------------------
;                       interface
;[ ------------------------------------------------------

  ProcedureDLL.l usp_analyse_string(hdc.l,texte.s,cString.l,cGlyphs.l,iCharset.l,dwFlags.w,iReqWidth.l,*sc.SCRIPT_CONTROL, *psState.SCRIPT_STATE, *piDx.l, *pTabdef.SCRIPT_TABDEF, *pbInClass.b, *pssa.l)
  ProcedureReturn ScriptStringAnalyse(hdc,@texte,cString,cGlyphs,iCharset,dwFlags,iReqWidth,*sc, *psState, *piDx, *pTabdef, *pbInClass, *pssa)
  EndProcedure 

  ProcedureDLL.l usp_text_out(*ssa.l, iX.l,iY.l,uOptions.l,*prc.RECT,iMinSel.l,iMaxSel.l,fDisabled.l) 
  ProcedureReturn ScriptStringOut(*ssa,iX,iY,uOptions,*prc,iMinSel,iMaxSel,fDisabled) 
  EndProcedure
  
  ProcedureDLL.l usp_position_to_char(*ssa.l,iX.l,*piCh.l,*piTrailing.l) 
  ProcedureReturn ScriptStringXtoCP(*ssa,iX,*piCh,*piTrailing)
  EndProcedure
  
  ProcedureDLL.l usp_char_to_position(*ssa.l,icp.l,fTrailing.l,*pX.l)
  ProcedureReturn ScriptStringCPtoX(*ssa,icp,fTrailing,*pX)
  EndProcedure

  ProcedureDLL.l usp_Free(*pssa.l)
  ProcedureReturn ScriptStringFree(@*pssa)
  EndProcedure 

  ProcedureDLL.l usp_itemize(pwcInChars.s,cInChars.l,cMaxItems.l,*psControl.SCRIPT_CONTROL,*psState.SCRIPT_STATE,*pItems.SCRIPT_ITEM,*pcItems.l)
  ProcedureReturn ScriptItemize(@pwcInChars,cInChars,cMaxItems,*psControl,*psState,@*pItems,*pcItems)
  EndProcedure

  
;] ------------------------------------------------------

can somone give me the trick ?

my second question is about irrlicht (very nice job done by thalius) i'm new to the 3d world and my first attempts are with irrlicht.

i'm using misfit 3d model for drawing my objects but i can't insrt them, the
compiler give me always an error (i export in ms3d format) is there a problem with this format or it's my code
i haven't a code my purpose is general , thanks for your replays , i realy love the job done with irrlicht thank's thalius. :shock:


and excuse my bad english. :oops:
thank's in advance.
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

i'm using misfit 3d model for drawing my objects but i can't insrt them, the
compiler give me always an error (i export in ms3d format) is there a problem with this format or it's my code
i haven't a code my purpose is general , thanks for your replays , i realy love the job done with irrlicht thank's thalius.
ms3d is supported but for more details. Compile your App as Console Application ( In the Console Window are errors displayed which should give a clearer indication of whats going on / wrong ) :)

Its not only my Work btw - ( Neotoma has done most of the hard base work digging up Frank Dodd's aging wrapper :)

shoot me a pm when you have any question or trouble with your Irrlicht code :)

Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
fraalg
New User
New User
Posts: 3
Joined: Tue Aug 28, 2007 12:39 pm
Location: italia

Post by fraalg »

thank's thalius , thank's for all the developpers of the irr wrapper :wink:

here is a short example for uniscribe.
rename the code of the first post "uniscribe10.pbi" and use it for this small example the high level api work without problem but i'm not in grad off draw the text in an other location.

Code: Select all

#window_option = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered

XIncludeFile "uniscribe10.pbi"

Procedure uniscribe_to_image(string.s,fid.l)
Protected hdc.l,tex.s,tex1.s
tex = string
If IsImage(101)
hdc = StartDrawing(ImageOutput(101))
Box(0,0,680,580,RGB(255,255,255))
DrawingFont(fid)
vex = #SSA_GLYPHS | #SSA_FALLBACK ;| #SSA_CLIP 

usp_analyse_string(hdc,tex,Len(tex),(1.5*Len(tex))+2,-1,vex,400,#Null, #Null,#Null,#Null,#Null,@psa)
FrontColor(RGB(0,0,0))

 usp_text_out(psa,x,y,#ETO_OPAQUE,#Null,11,12,#False) ; 11,12 caracters hightlight....

 ; why the text is drawn at 0,0  ??????????
; Debug usp_position_to_char(psa,99,@charr,@aa)
; Debug charr ; le num du caractere
; Debug aa 
; Debug usp_char_to_position(psa,3,#False,@aa)
; Debug aa 
 usp_Free(psa)
StopDrawing()
EndIf 
EndProcedure 

Procedure pbdraw_to_image(string.s,fid.l)
Protected hdc.l,tex.s,tex1.s
If IsImage(100)
hdc = StartDrawing(ImageOutput(100))
Box(0,0,680,580,RGB(255,255,255))
DrawingFont(fid)
DrawText(100,40,string)
StopDrawing()
EndIf 
EndProcedure 

Global event.l,quit.l,ff.l,string.s

CreateImage(100,680,180)
CreateImage(101,680,180)

OpenWindow(0,0,0,700,400,"testwin",#window_option)
CreateGadgetList(WindowID(0))
ImageGadget(1,10,10,680,180,ImageID(100),#PB_Image_Border)
ImageGadget(2,10,200,680,180,ImageID(101),#PB_Image_Border)

SetWindowLong_(GadgetID(2), #GWL_STYLE, GetWindowLong_(GadgetID(2), #GWL_STYLE)|#SS_NOTIFY) 

string = "HelloيُساوِيWorld"

LoadFont(0,"arial",20)

ff = FontID(0)

uniscribe_to_image(string,ff)
pbdraw_to_image(string,ff)

SetGadgetState(1,ImageID(100))
SetGadgetState(2,ImageID(101))

quit = 0

Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Gadget
   Select EventGadget()
    Case 2 

   EndSelect  
Case #PB_Event_CloseWindow : quit = -1 
EndSelect
Until quit = -1

any suggestions :?:
thank's in advance.
Post Reply