How get Underline Type of Character?


this function attribute of textrange:

template <class textattrtype, class _val_type>

errorcode gettextscriptprovider::gettextattribute(const indesign::textrange& textrange,

    const classid& attrclassid,

    _val_type& value)

{

  // assume failure.

  value=0;

  errorcode status = kfailure;

 

  {

  // check if text range valid.

  if (textrange.isvalid() == kfalse)

  {

  //sniplog("textrange invalid - must have text selected first.");

  break;

  }

  // query text model , range data,

  interfaceptr<itextmodel> textmodel(textrange.querymodel());

  rangedata rangedata = textrange.getrange();

 

  // query compose scanner access text attributes

  interfaceptr<icomposescanner> composescanner(textmodel, usedefaultiid());

  if (composescanner == nil)

  {

  assert(composescanner); break;

  }

   // query attribute report interface

  int32 attrlen = 0;

  interfaceptr<const iattrreport> attrreport(composescanner->queryattributeat(rangedata, attrclassid, &attrlen));

  if (attrreport == nil)

  {

  //sniplog("could not find text attribute class id 0x%x on selected text!", attrclassid.get());

  break;

  }

 

  // query attribute interface

  interfaceptr<textattrtype> attr(attrreport, textattrtype::kdefaultiid);

  if (attr == nil)

  {

  //sniplog("attr nil! (class id 0x%x)", attrclassid.get());

  break;

  }

 

  // attribute value.

  const _val_type tempvalue = attr->get();

  value = tempvalue;

  status = ksuccess;

  } while (false);

 

 

  return status;

}

 

this code underline type, no working:

int16 underlinetype;

res=gettextattribute<itextattrint16, itextattrint16::valuetype>(ocharrange, ktextattrcharunderlinetypeboss,underlinetype);

 

how underline type of character?

ktextattrcharunderlinetypeboss doesn't have itextattrint16 interface.

use itextattrstroketype textattrtype.



More discussions in InDesign SDK


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working